Specifying a Default Event for the Code Window

See Also

The first time you select a control instance in the Object box of the container's code window, Visual Basic selects an event to highlight in the Procedure box, and inserts into the code window an event procedure for that event.

If a control doesn't specify this user interface default, Visual Basic selects the first event alphabetically.

Note   While you're working with a new control in the development environment, before you've specified the user interface default, Visual Basic may sometimes select the default event based on internal considerations, such as which event went into the type library first.

To specify the user interface default for your control's events

  1. In the UserControl code window, place the cursor on the declaration of the event you want to specify as the user interface default.

  2. On the Tools menu, click Procedure Attributes to open the Procedure Attributes dialog box.

  3. The property should be shown in the Name box. If not, use the Name box to select it.

  4. Click the Advanced button to show advanced features. Check User Interface Default in the Attributes box, then click OK or Apply.

Tip   You can only mark one event as the user interface default. Choose the event users will most frequently place code in.