04-03-2012, 12:57 PM
This code snippet was made after hours of work on my project QuickClean
To make a custom event, the first thing you are going to do is declare the event for global usage in the global declarations section of your class. For example,
Then, in order to call this event, you must use the code snippet RaiseEvent
So, using our same example:
Now, every time the SwitchMode method is called, the event onModeSwitch will be called. This event can now be accessed in the code viewer on any new instance of this class.
To make a custom event, the first thing you are going to do is declare the event for global usage in the global declarations section of your class. For example,
Code:
Public Class Modes
Event onModeSwitch()
'Sample method
Public Sub New()
Msgbox(":D")
End Sub
End Class
Then, in order to call this event, you must use the code snippet RaiseEvent
So, using our same example:
Code:
Public Class Modes
Event onModeSwitch()
'Sample method
Public Sub New()
Msgbox(":D")
End Sub
'Sample Method to Raise Event
Public Sub SwitchMode()
RaiseEvent onModeSwitch()
End Sub
End Class
Now, every time the SwitchMode method is called, the event onModeSwitch will be called. This event can now be accessed in the code viewer on any new instance of this class.