You will need to work with more than one form while developing Windows based applications in C#. In this code snippet, Anand examines the steps required using Visual C# 2008
(1) Start Visual Studio 2008 (Start | All Programs | Microsoft Visual Studio 2008 | Microsoft Visual Studio 2008)
(2) Create a new C# project from File | New | Project. The New Project dialog box opens up as shown in Figure 1. Modify the project name and change the target directory if required.
(3) A new form with the title Form1 appears on the screen. Add a Button control to it from the Toolbox. Change the caption to OK by altering the Text property from the Properties window.
(4) Add another form to the project by selecting Add Windows Form item from Project menu. Add a Label control to it and change its text as “This is Form 2”
(5) Activate Form 1 by double clicking Form1.cs from Solution Explorer. Double click the Button control and add the following code
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">Form2 f2 = new Form2();
(6) Run the project by pressing F5 key. You can also run by selecting Start Debugging item from the Debug menu.