Writing Event Handlers
Your source code usually responds to events that might occur to a component at run time, such as a user clicking a button or choosing a menu command. The code that responds to an occurrence is called an event handler. The event handler code can modify property values and call methods.
To write an event handler
- On your form, click the component for which you want to write an event handler.
- To create the default event for the component, double-click the component on the form.
- To choose another event for the component, click the Events tab in the Object Inspector, locate the event, and double-click its text box. The Code Editor appears.
- Type the code that will execute when the event occurs at run time.