Raise Event Statement

Causes an event to occur.

Syntax

Raise Event event_name [ argument_list ]

Parts

event_name
The name of an event.
argument_list
Zero or more expressions with a comma between each, all optionally between parentheses (“( )”).

Instructions

The mandatory name (event_name) is an event declared in the same module. It is an error to try to cause an event in a different module.

Examples

Class CountdownTimer
    Event Tick(second As Int32)
    Event Done
    Method Start(seconds As Int32)
        While seconds > 0
            Raise Event Tick seconds
            Sleep 1s
            seconds -= 1
        End While
        Raise Event Done
    End Method
End Class

New CountdownTimer myCountdown
myCountdown.Start 10

' ...

Sub myCountdown_Tick Handles myCountdown.Tick
    PrintLine $"Countdown is at {second}"
End Sub

Sub myCountdown_Done Handles myCountdown.Done
    PrintLine "Countdown is done"
End Sub

See also