Export (0) Print
Expand All
Expand Minimize

Code: Displaying One Form from Another (Visual C#)

Visual Studio .NET 2003

This example displays a second form from another Windows Form.

Example

private void button1_Click(object sender, System.EventArgs e)
{
    Form2 frm = new Form2();
    frm.Show();
}

Compiling the Code

This example requires:

  • Two Windows Forms named Form1 and Form2. Form1 contains a Button control named button1. Set button1's Click event handler to button1_Click.

See Also

Windows Forms Example Topics | Windows Forms

Show:
© 2015 Microsoft