Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleMake a class that raises an event
Keywordsevent, raise event, RaiseEvent
CategoriesActiveX 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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated