This documentation is archived and is not being maintained.

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

Visual Studio .NET 2003

This example displays a second form from another Windows Form.


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

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