LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET events, what am I doing wrong?

I'm trying to register for a .NET event and I can't seem to get it to work. The Main.vi is posted in the snippet below but I've attached the Main and Callback vi's as a zip (2020 and 2016 versions). I don't really know much about .NET so I have a feeling I'm just not understanding something fundamental. I'm sure there are other ways to do what this example is attempting (detecting a network availability change) but the important point for me is to resolve the event problem and understand how to make this work, so please don't focus on alternatives.

 

NetworkAvailability NET Event Test Main.png

0 Kudos
Message 1 of 4
(1,665 Views)

Have you tried to make your VIs run in UI thread?

 

George Zou
0 Kudos
Message 2 of 4
(1,643 Views)

@zou wrote:

Have you tried to make your VIs run in UI thread?

 


I haven't done anything "special" so I guess not. How do I do that? Also, can you explain some of the background of why that would be significant?

0 Kudos
Message 3 of 4
(1,577 Views)

VI Properties => Execution => Preferred Execution System => user interface

 

Some .Net functions require "Single Threaded Apartment" or STA.  i.e. UI thread.

 

You can google "LabVIEW .NET single-threaded apartment (STA)" for better explanation.

 

 

George Zou
0 Kudos
Message 4 of 4
(1,564 Views)