Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi. Im trying to do a math-program in Visual Studio C# 2010. So, when the user press the button, then a whole new form should pop up. How do i do this?

Sorry for my bad english. Im from sweden.
Posted

1) Create a form in the designer
2) in your button click do the following:
C#
form2 f = new form2();
f.ShowDialog();
 
Share this answer
 
C#
Form2 form = new Form2();
form.ShowDialog();
 
Share this answer
 
Comments
Wendelius 9-Sep-11 16:28pm    
OP's comment: "Thank you all for your answers. Specially to John Simmons."
God afton,

To add to the previous answers (which explain how to show a modal dialog) you can also show the form as modeless.

The difference is that when you show a modal dialog user isn't able to access the previous form (Form1 in this case) until the dialog is closed. If you want both of the forms to be accessible at the same time you can use Show method[^]
 
Share this answer
 
form3 frm=new form3;
frm.show();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900