Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
197 views
in Technique[技术] by (71.8m points)

Visual Studio C# 2010 adding/editing new additional forms to a program

So I am new to actually building GUI and I am creating a project where when you click on one button you open a new form. With this new form I want to be able to add and edit things to it.

In my solution explorer it is only showing the first form that I originally create, not the second one. I went online and used one of those little microsoft blurbs about creating a new form when a button is clicked, and I am a little lost from there.

My program is going to have multiple buttons that you click and they open certain forms. I understand that I have the button_click set to create a new form. I now want to know how to edit these forms that are created.

I tried refreshing my solution explorer and it wouldn't show my newly created design. (I thought that could be one of my possible errors, haha) Could someone please let me know what I should be doing?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First add a new form. Right click on your project (my project is called Test) and give it a name (I called it TestForm): Create a form

Then, add the following code to your button:

TestForm MyForm = new TestForm();
MyForm.Show();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...