Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multi-forms program

Status
Not open for further replies.

rebShaul

Programmer
Jun 22, 2003
15
IL
Hello,

I want to creat a multi-forms program (C# Windows Application project). How do I open Form2 from Form1 which is the main form of the program?
(For example, I want that Form2 will be loaded as a consequence of a menu click at Form1).

Thanks,
Shaul.
 
Using your menu item example....

Instantiate the class of the new form on the click event and then use the show method on the form class instantiated.

Craig
 
Try this:
private void mnuForm2_Click(object sender, System.EventArgs e)
{
Form frm2 = new Form2();
frm2.Show();
}
 
Are you sure you want to open the form in a new window? You could instead develop a control as a panel and then have the control take over the client space of the first window upon the menu click. Then of course you need another menu click to switch back to the other view.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top