To create an event handler in C# or C++
1. Click the form or control that you want to create an event handler for.
2. In the Properties window, click the Events button ().
3. In the list of available events, click the event that you want to create an event handler for.
4. In the box to the right of the event name, type the name of the handler and press ENTER.
Tip Name the event handler according to the functionality of the event; for example, for the Click event, you can type StartProcess as the event handler.
The Code Editor appears, showing the code for the form, and an event handler method is generated in your code similar to the following:
PHP Code:
// C#
private void StartProcess(object sender, System.EventArgs e)
{
// Add event handler code here.
}
// C++
private:
System::Void StartProcess(System::Object * sender,
System::EventArgs * e)
{
// Add event handler code here.
}
5. Add the appropriate code to the event handler.