Multiple Forms Handling

• A windows application is a collection of one or more windows forms.
• By default, it contains only one form, called as “Form1”.
• Later, you can add new forms to the project.

Adding New Forms to the Project:
• In the “Solution Explorer”, right click on the project and choose “Add” - Windows Form”.
• In the dialog box, enter the name of the new form.
• Then the new form will be created.

Deleting Forms from the Project:
• In the “Solution Explorer”, right click on the required form, that you want to delete and click on “Delete” option.
• Click on OK for confirmation.

Changing Startup Form:
• Even, if you add multiple forms to the project, when the project is started, the “Form1” will be opened by default. This is called as “Startup form”.
• To change the startup form, change the following statement with the required class name in the “Program” class’s Main() method.

Application.Run(new Form1());
Invoke Forms at Run Time (Programmatically):
• To open any form at run time programmatically, you require to create an object for the form class.
FormName obj = new FormName();

multiple forms handling

Multiple Forms Handling


private void Form1_DoubleClick(object sender, EventArgs e)
Form2 f = new Form2();

Controls in Windows Applications

I. Core Controls
1) Button
2) Label
3) LinkLabel
4) TextBox
5) PictureBox
6) Panel
7) GroupBox
8) CheckBox
9) RadioButton
10) ListBox
11) ComboBox
12) DomainUpDown
13) NumericUpDown
14) DateTimePicker
15) MonthCalendar

II. Background Process Controls

16) Timer
17) ProgressBar

III. Menu Controls

18) MenuStrip
19) ContextMenuStrip

IV. Dialog Box Controls

20) ColorDialog
21) FontDialog
22) FolderBrowserDialog
23) OpenFileDialog
24) SaveFileDialog
25) PrintDialog

V. Database Controls

26) DataGridView

VI. System Tray Controls

27) NotifyIcon

VII. Other User Friendly Controls

28) TabControl
29) RichTextBox
30) TrackBar
31) TreeView