Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating Custom Events
#1
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,
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.
My Blog | My Setup | My Videos | Have a wonderful day.


Messages In This Thread
Creating Custom Events - by brandonio21_phpbb3_import2 - 04-03-2012, 12:57 PM
Re: Creating Custom Events - by Vinwarez - 04-04-2012, 01:49 PM
Re: Creating Custom Events - by Vinwarez - 04-05-2012, 04:25 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)