|
|
Title | Make a class that raises an event |
Keywords | event, raise event, RaiseEvent |
Categories | ActiveX Controls, Software Engineering |
|
|
Declare the event in the class as in:
Public Event BadSsn(ByVal bad_ssn As String)
Raise it as in:
RaiseEvent BadSsn(ssn)
In the main program, declare an instance of the class using the WithEvents keyword so the program can catch the event.
|
|
Private WithEvents ssn_checker As SSNChecker
Private Sub ssn_checker_BadSsn(ByVal bad_ssn As String)
MsgBox bad_ssn & " has an incorrect format"
End Sub
|
|
|
|
|
|