Dynamically Registering for Events
- Updated2026-08-05
- 3 minute(s) read
Dynamic event registration allows you to use VI Server references to specify at run time the objects for which you want LabVIEW to generate events. Use dynamic registration to implement event logic programmatically so you can reuse user interface code.
Before you configure events for the Event structure to handle, review the caveats and recommendations for using events in LabVIEW.
You can use dynamic registration with VI Server references like Application events, VI events, or Control events.
What to Use
Use the following block diagram objects to dynamically register events.
| Object | Location on Functions Palette |
|---|---|
Register For Events![]() |
|
While Loop![]() |
|
Event Structure![]() |
|
Unregister For Events![]() |
What to Do
Create the following block diagram to dynamically register the Mouse Enter and Mouse Leave events on a string control.

The following list describes important details about the previous diagram.
- Obtain VI Server references to the objects for which you want LabVIEW to generate events. To obtain a control reference constant, like the string control constant from the previous illustration, use a Property Node to query the VI for its controls or right-click the control and select from the shortcut menu.
- Use the Register For Events function to dynamically register for
events. You can register for multiple events for a single reference by resizing this
function and selecting another event. Click the down arrow on the event source input and
select the event you want LabVIEW to generate for the reference, such as the Mouse
Enter and Mouse Leave events shown in the previous
illustration. After registration, LabVIEW queues events as they occur until an
Event structure executes to handle the events.Tip You can view the registered events in the Context Help window when you hover over the event registration refnum.
- Right-click the event selector label to display the Edit Events dialog box. Use the dialog box to configure an Event structure to handle a dynamically registered event. The Event Sources section of the dialog box contains a Dynamic subheading that lists each dynamically registered event source. After you select the events you want the Event structure to handle, design the case to handle the event data.
- Use the Unregister For Events function to stop event generation. When the Unregister For Events function executes, LabVIEW unregisters all events the event registration refnum specifies, destroys the event queue associated with the event registration refnum, and discards any events that remain in the queue.
Caveats and Recommendations for Dynamically Registering Events
- Wire the event registration refnum input of the Register For Events function only when you want to modify an existing registration.
- Wire each Event structure that handles dynamic events to a unique Register For Events function. Branching the event registration refnum wire of a Register For Events function allows multiple Event structures to pull events from one queue, resulting in a race condition that may cause unpredictable behavior.
Examples
For examples of dynamically registering events, refer to labview\examples\Dialog and User Interface\Events\Events.lvproj.
Related Information
- Choosing How an Event Structure Monitors For Events
Event registration is the term for specifying which events you want a LabVIEW Event structure to handle. LabVIEW can register events either statically or dynamically.
- Caveats and Recommendations when Using Events in LabVIEW



