Coding Events of an ActiveX Control
Just as you can set or evaluate the properties of the control at runtime, you can code the control's events, too. To get a list of all the events associated with an ActiveX control, open the Procedure box in the Module window. Make sure that the control name for your ActiveX control is listed in the Object box. Figure 21.10 shows all the events for the Calendar control.
Figure 21.10. Viewing the events of the Calendar control.

The Calendar control's AfterUpdate event is triggered when the user selects a date from the calendar. The following code changes the value of the txtDateSelected text box to the Value property of the calPickADay control. This code is placed in the Calendar control's AfterUpdate event so that it executes any time the user selects a date on the calendar:Private Sub calPickADay_AfterUpdate()
txtDateSelected.Value = calPickADay.Value
End Sub
![]() | This codeand most of the code in this chapteris in the CHAP21EX.MDB file on the book's CD-ROM. This example is found in the frmPickADay form. |