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

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Solved!
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?

 

Thanks,

Shaun

Download All
0 Kudos
Message 1 of 6
(2,900 Views)

Hi,

 

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

 

http://forums.ni.com/ni/board/message?board.id=170&thread.id=474834

 

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.

 

Thanks
John 

0 Kudos
Message 2 of 6
(2,891 Views)

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:

 

Error.png

 

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

0 Kudos
Message 3 of 6
(2,882 Views)
Solution
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):

http://digital.ni.com/public.nsf/allkb/2AF19EBDFA4AC82D862576B6006E7FE8

 

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
(2,877 Views)
Thanks, that was it.
0 Kudos
Message 5 of 6
(2,869 Views)

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 Callback.vi 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.

 

Thanks,

Biggeveen

0 Kudos
Message 6 of 6
(2,508 Views)