LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.net dll reference number

I am reading from a device through a .NET DLL.  The read gives me a variant, and its type is reference number.  I believe I am getting a reference number for a .NET object, and I need to get to its property to get its real value.  How do I do that?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 3
(2,234 Views)

Hi jyang72211, 

 

Are you trying to use .NET property nodes? Example: Converting your .NET reference (of variant data) to some other type of data (by using the variant to data.vi) and then wiring the reference in to a property node?

 

 

Thanks,

 

Bobby Breyer
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(2,199 Views)

@jyang72211 wrote:

I am reading from a device through a .NET DLL.  The read gives me a variant, and its type is reference number.  I believe I am getting a reference number for a .NET object,[...]


Variant is a common type for API functions in .NET and ActiveX. LV has functions to convert any data type into a variant ("to variant") and to extract any data type from the variant ("from variant"/"Variant to Data").

Putting data to variant is easy, but when extracting, you need to know which type you expect in the variant. Therefore, you have to connect a prototype of the data type to the "Variant to Data" function.

 

If the data is numeric, you have to connect an appropriate numeric constant (e.g. U16) to it.

If it is a handle to a .NET object, you have to create a constant for such a reference. You can do this by several different approaches. But all of them have in common that you have to know (and browse for) the exact object type of the .NET object "behind" this reference.

One way for instance is to create a reference control on the front panel, browse for the .NET object type and then change this control to be a constant.

 

hope this helps,

Norbert

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