LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

communicat​e between C# window applicatio​n and Labview.

Hello all!

 

Now what I shall do is to use both labview application and C# window application for my project. Basically it's that the state change in labview triggers an event in C#. As a short description, my labview application receives UDP message from an external device and shows them on the front panel. I'd like that when the received message reaches for example 10, the C# application is triggered to implement a switch.

 

I got the idea to use .Net object in labview, a constructor node to get a reference to my C# app, and in my C# app expposing public methods telling the app something happened in the LV app. I think that would help but I don't know how.

 

Anybody could give me an example of that. The importance for me is to know how should I set the constructor node in labview, and what is to add in C#, like "using labview" in the header.

 

Thanks in advance!

 

Chao

0 Kudos
Message 1 of 4
(2,660 Views)

Once you constructed the .NET parent object (the one which provides the access to your "reaction code"), you can use invoke and/or property nodes to call into the .NET assembly.

So if your object exposes a method which should be called once you hit 10 samples, you simply count the number of samples available in LV and once 10 are available, you use an invoke node to call the appropriate method.

 

There are a bunch of examples provided with LV, for instance one called "Task Monitor Using .NET Objects".

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 4
(2,656 Views)

Hi Norbert!

 

Thanks for the reply. But could you tell me where to find this example? Seems that in NI example finder there's no this.

 

Besides, to react to this event in labview, what should I add and use in my C# app to receive this change from labview. Do you

 

have any idea?

 

Thanks

0 Kudos
Message 3 of 4
(2,647 Views)

Please post what you got so far (so the .NET DLL and your VI calling that DLL).

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 4
(2,621 Views)