From Thursday, May 23rd (05:00 PM CDT) through Friday, April 24th (1:30 AM CDT), 2024, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.


Showing results for 
Search instead for 
Did you mean: 

Problem with .NET Events - What am I doing wrong?

Go to solution

Hi All,


I'm trying to use the System.Net.WebClient asynchronous download method (so that I can get an indication of progress for my downloads) but seem to be running into problems getting the .NET event handling to work. My current attempt (see attached VIs) ends up with a rather ugly crash but I'm not sure what I'm doing wrong.


Could anyone point me in the right direction?




Download All
0 Kudos
Message 1 of 6



What Windows versions are you using?  It sounds similar to the issue I'm having.  Is the error message the one you see here?


One thing I noticed between XP and 7 is that LabVIEW can't get the members in e.  In XP, I could use a property node directly connected to e.



0 Kudos
Message 2 of 6

It definately looks like something could be similar, my error (even with all code referencing e removed, so that my callback literally sets a Value (Signalling) to the boolean control) is as follows:




(I'm running LabVIEW 2009f3 on Windows Vista)

0 Kudos
Message 3 of 6
Accepted by topic author shew82

Hey John,


After some more searching, I came up with the solution to my problem (which might solve yours also):


or in short, on your callback VI, make sure the Sender and e elements of the Event Data cluster are the proper data types for your event (ie Sender = system.object and e = whatever your event's arguement's data type is).

Message 4 of 6
Thanks, that was it.
0 Kudos
Message 5 of 6

Hey Shaun and others,


Just stumbled upon thread. I'm now using a synchronous .NET HTTP client in LabVIEW 2010 / Win 7 and XP, want to change the client to asynchronous to be able to abort a request. I use the WebRequest class instead of the WebClient class.


Hope you can provide some help on this 2 years old thread.


The code posted in message 1 doesn't work at my side, no event is generated, the Download Complete is never fired and the VI never ends execution without abort button.


Are you able to share (parts of) your implementation?


My idea was to implement something similar to this example at MSDN.




0 Kudos
Message 6 of 6