NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Access fields in .NET Object References

I have a .NET dll with a class and method that passes back to me an array of object references.  In LabVIEW I would just use a for loop and then feed that .NET Refnum into a .NET property node and extract the data.  How do I do this in TestStand?

 

I have gone ahead a created a local variable array of object references but I am not sure what to do with them now.

 

I don't seem to have the ability to access the "Get Property" option though, only "Call Method"

 

Any help would be much appreciated.

 

Thanks,

Matt

0 Kudos
Message 1 of 3
(3,465 Views)

If the class you specify in the .NET adapter has public properties or fields then it should let you do "Get Property". Make sure the fields are really public and that you have the right class specified for the objects you are accessing.

 

Basically, if you are storing the objects in a teststand object array, then the elements of the teststand object array are already the same as the elements of the dotnet array. You can just loop based on the number of items in the array and make calls by specifying Locals.myarray[Locals.i] as the class object (for example) when you specify the .NET step inside the loop. Be sure to uncheck the "Create object" checkbox as you want to use the object you are specifying by expression rather than creating a new one.

 

Hope this helps,

-Doug

0 Kudos
Message 2 of 3
(3,461 Views)

One thing that comes into my mind is also to make sure the property that you want to use is in the class you are casting the object to.

If the Property is somewhere in the base class, please make sure you have the Show Base Class Members checkbox enabled, which I think is disabled by default.

 

Maciej


0 Kudos
Message 3 of 3
(3,438 Views)