.NET Events
- Updated2025-08-15
- 2 minute(s) read
.NET events are the actions taken on a .NET object, such as clicking a mouse, pressing a key, or receiving notifications about things such as running out of memory or tasks completing. Whenever these actions occur to the object, the object sends both an event to alert the .NET container and the event-specific data. The .NET object defines the events available for an object.
To use .NET events in an application, you must register for the event and handle the event when it occurs. .NET event registration is similar to dynamic event registration. However, the architecture of a .NET event VI is different from the architecture of an event-handling VI. The following components make up a typical .NET event VI:
- .NET object for which you want to generate an event.
- Register Event Callback function to specify and register for the type of event you want to generate. The Register Event Callback function is a growable node capable of handling multiple events, similar to the Register For Events function.
- Callback VI that contains the code you write to handle the event you specify.
When you wire a .NET object to the Register Event Callback function and specify the event you want to generate for that object, you are registering the .NET object for that event. After you register for the event, create a callback VI that contains the code you write to handle the event. Different events might have different event data formats so changing the event after you create a callback VI might break wires on the block diagram. Select the event before you create the callback VI.