Defining Event Procedures in Notepad
using System; using System.Windows.Forms; public class Form3 : Form { public Form3() { InitializeComponent(); } private void InitializeComponent() { this.Text = "My New Form"; this.Load += new EventHandler(TestProc1); this.Click += new EventHandler(TestProc2); } private void TestProc1(object sender,EventArgs e) { MessageBox.Show("Load Event Occured."); } private void TestProc2(object sender,EventArgs e) { MessageBox.Show("Click Event Occured."); } static void Main() { Application.Run(new Form3()); } }
Placing controls on a form
By default we are provided with no. of controls where each control is a class. These controls are available in ToolBox window on LHS of the studio, which displays all controls, organized under different Tabs (groups). To place a control on the form either double click on desired control or select the control and place it in the desired location on form.