Define handlers for .NET events
- Last Updated: February 11, 2026
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
If you use a .NET delegate to define an ABL class event,
or if you are defining an ABL method or internal procedure as a
handler for a .NET event, you must define your event handler signature
to match the delegate specified for the event. (In .NET, you implement
event handlers by defining derivations of the specified delegate
type.) For both ABL class events and .NET events, ABL only supports
delegates whose signatures conform to the Microsoft .NET convention
for event handler signatures. This signature convention provides
for a VOID return type and two INPUT parameters, where the first
parameter is a reference to a .NET System.Object that
published the event, and the second parameter is a reference to
a .NET System.EventArgs (or a derived class) that
provides event arguments as public members of the class.
Syntax
The signature for any ABL event handler defined for a .NET delegate must conform to this general syntax:
|
- EventHandlerName
- The name of your class-based method or internal procedure.
- sender
- Object reference to the .NET class instance that published the event.
- args
- Object reference to an event arguments class that contains public properties that provide arguments for the event. Note that for a .NET event, args references an object that is created by .NET and added to the ABL session object chain when the event handler executes. Like any other locally scoped object reference, if you do not save the value before the event handler terminates, ABL automatically garbage collects this object at some point after the event handler returns.
- EventArgsClass
- The class type name of the event arguments class. This is always
System.EventArgsor one of its derived classes. Thus,System.EventArgsis the base class for all event arguments classes that an event handler can receive through this INPUT parameter.
To identify the exact handler signature for a given .NET delegate, you must look up the delegate in the appropriate class library documentation or use the Class Browser of Progress Developer Studio for OpenEdge to inspect the class. For .NET events supported on the built-in .NET classes provided by OpenEdge and described in the Class, Interface, and Enumeration Reference, each event reference entry described further on in this section indicates the delegate type associated with the event along with its matching event handler signature. Otherwise, to locate the delegate in .NET class library documentation, find the event you want to handle in the documentation for the class that publishes the event. The event definition includes a reference to its delegate type. The documentation for the specified delegate shows the .NET signature you must use for your event handler.
If
you do not trap and handle an error raised within a handler for
a .NET event, whether it is raised as the ERROR condition or thrown
as an error object, the AVM does not throw an Exception back
to .NET, but displays an error message on the default output device
and continues processing as if no error had occurred. So, unlike
handlers for ABL class events, if you subscribe multiple handlers
for a .NET event, all the handlers execute regardless if one or
more of them raises an error.