LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does LabVIEW 8 support use of .net deligates?

Hi,
 
A colleague and I are trying to use C# code written under .net in LabVIEW. (He knows the .net stuff, I do the LabVIEW). We want to do this to avoid reproducing common tasks and funcions in both C# and labVIEW. Or to put it another way - I get to steal some of his code for free Smiley Very Happy
 
We have a basic function working, but have code we wish to use that utilises delegates.
 
We have found info on the forums saying LabVIEW 7.0 didn't work with .net code that used delegates, but nothing on LabVIEW 8.0. Can anyone advise on this?
 
Regards,
 
Bandit.
 
 
0 Kudos
Message 1 of 8
(4,203 Views)

Hi,

You can actually use delegates with LV 8.0

How is another question.  I'll look into that for you.

http://digital.ni.com/public.nsf/websearch/E8BD3B03D5EE979886256D36007A65DE?OpenDocument

AdamB

Applications Engineering Team Leader | National Instruments | UK & Ireland
Message 2 of 8
(4,187 Views)

Thanks Adam - I look forward to your next post.

Bandit

It only takes a click to rate an answer - once you have signed in.

0 Kudos
Message 3 of 8
(4,181 Views)
Hi Bandit,
 
Here's a vi that shows the functionality.  It's using the eventcallback function.
 
Another way is to use an invoke node on the container (with your .net function) and there is the invoke(Delegate Method) method you can use.
 
 
AdamB
 
 
Applications Engineering Team Leader | National Instruments | UK & Ireland
Message 4 of 8
(4,177 Views)
Actually, LabVIEW doesn't support delegates in the raw form - such as you might pass in a method argument. However, starting with LabVIEW 8.0, we do support .NET events, which are a form of delegate usage. So - if you can allow the client to register to the delegate via an event, and then execute the method, you can use the built in support. This is pretty straightforward, although I recognize that it's an extra step.
Message 5 of 8
(4,168 Views)

Thanks guys, we are up and running now. Your help was invaluable.

Best Regards,

Bandit

0 Kudos
Message 6 of 8
(4,147 Views)

Hi, I'm currently attempting to add an additional function into a .NET .dll (written in c++) to generate a .NET event, that can be used by the Labview register event callback VI.  I then need this event to register to a delegate input of an existing function within the .dll.  I believe this is what you were describing here, however I'm currently struggling to find the relevant c++ documentation.  If you could steer me in the right direction on how to achieve this I'd greatly appreciate it.

Many Thanks,

Robert

0 Kudos
Message 7 of 8
(3,387 Views)

My delegate function has the following structure:  void (int,int,std::string).  Does this mean I need to generate a custom event Arg structure?

0 Kudos
Message 8 of 8
(3,354 Views)