Learning about events

To find out which events are supported by a particular control:

1. Add a control to a UserForm.

2. Double-click the control to activate the code module for the UserForm. The VBE will insert an empty event handler procedure for the default event for the control.

3. Click the drop-down list in the upper-right corner of the module window, and you'll see a complete list of events for the control (see Figure 13-11).

Figure 13-11: The event list for a CheckBox control.

4. Select an event from the list, and the VBE will create an empty event handler procedure for you.

To find out specific details about an event, consult the Help system.The Help system also lists the events available for each control.

Event handler procedures incorporate the name of the object in the procedure's name.Therefore,if you change the name of a control,you'll also need to make the appropriate changes to the control's event handler proce-dure(s).The name changes are not performed automatically! To make things easy on yourself, it's a good idea to provide names for your controls before you begin creating event handler procedures.

0 0

Post a comment