Events are characteristics that the class may respond to. You add an event for a class by first declaring it with the Event keyword in the General Declarations section of a Form or Class module. EG:

Public Event Processed
'This is in a class module called clsMine

The event can then be fired within the class with the RaiseEvent keyword. EG:

RaiseEvent Processed()

For an instance of the class to respond to the raised event, the module that created an instance of the class must first have declared the class with the WithEvents keyword. EG:

Private WithEvents objInstance as clsMine

Then the module should make a procedure to deal with the instance's events. EG:

Private Sub objInstance_Processed()
'Misc code to handle the event End Sub

Class modules offer the Initialize and Terminate events. Notable exceptions include the "class" modules of Forms and Reports (in Access). For those classes, use the Load and Close events.

Page Modified: (Hand noted: ) (Auto noted: )