ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shared variable .net refnum

Solved!
Go to solution

Hi,

 

How can I pass .net references between different Vi's in the same project? Is there a way to store the reference in a shared variable?

0 Kudos
Message 1 of 5
(4,205 Views)

You could quite easily store the .NET reference in a global variable (Global VI) or FGV and then dish it out to whoever wants to use it.

 

Having said that I would encourage you to consider wrapping operations on the reference into some form of singleton to better manage atomic access to the reference in case it isn't entirely thread-safe.

0 Kudos
Message 2 of 5
(4,196 Views)

Hi,

 

Sorry, I am new to labview and don't quite understand how I can easily do this. What exactly should be in the global vi that stores this refnum. I have attached pictures of my failed attempt at it.

 

Thanks for the quick response

Download All
0 Kudos
Message 3 of 5
(4,180 Views)
Solution
Accepted by vikramps65

You're almost there. Change the type of the .NET reference on your Global VI by right-clicking on the control. This will allow you to hook up to your VI.

0 Kudos
Message 4 of 5
(4,173 Views)

Well that is awfully easy. I feel foolish to even not try that.

 

Thanks for the help. Will start using it in another VI's and see if there is a problem. Thanks.

0 Kudos
Message 5 of 5
(4,162 Views)