From Xojo Documentation

Language Keyword

Used on a class to call the implementation of an event definition on a subclass.


RaiseEvent EventName [(parameters)]

Part Type Description
EventName The name of the event that you want to trigger.
Parameters Parameters to EventName, if any.


EventName is the name of the event that you want to call. If the event requires parameters, then they are passed as the optional parameter to RaiseEvent. RaiseEvent is useful when you have an Event Definition that has the same name as a method and the ordinary way to call an event definition is ambiguous.

The only place you can use RaiseEvent is in the class definition where you added the Event Definition. In particular, you cannot raise an event from an instance of the class on the window, nor can you raise the event from outside the class. If you want to arbitrarily call an event, you will need to create a supporting method within the class as well that raises the event.

Sample Code

// MyEvent is an Event Definition on the class
RaiseEvent MyEvent

// MyTestEvent is an Event Definition with String and Integer parameters
RaiseEvent MyTestEvent("Hello", 42)

// For an event that returns a value you can call it like this
Dim value As Integer
value = RaiseEvent MyReturnEvent("Hello")

// RaiseEvent is optional, so you can also call the event by using its name
MyTestEvent("Hello", 42)
value = MyReturnEvent("Hello")