em 10-17-2022 02:52 PM
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.
em 10-17-2022 03:44 PM
Have you tried to make your VIs run in UI thread?
em 10-20-2022 03:50 PM
@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?
em 10-20-2022 04:13 PM
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.