06-17-2011 01:33 AM
Hello,
I would like to put different references from a .NET component in an array.
But I cannot put different references in the same array.
I tried to put them in a cluster which worked, but I then cannot add more references, cluster is not dynamic I guess.
How can I make some sort of array which contains different references, which I then can add more references if needed.
gr,
06-17-2011 04:09 AM
I think I solved it!
I use the .NET object to variant.
Then I put the variant in an array.
When I want to get the refnum I use the To .NET object.
Dont know if this is the best solution but its the only one I can find.
gr,
06-17-2011 06:40 AM
Well some parts are not working.
06-17-2011 06:52 AM - edited 06-17-2011 06:55 AM
Well some parts are not working(above reply can be ignored!).
Below I made a screenshot of the program when the refnum is created by a constructor, converted to variant and then added in an array.
Here you can see that I can select the "Value" property, its writed and the readed.
Below is the part where after the init, the variant is chosed to get the refnum.
As you can see when I want to edit or read the property it is not available.
Now how can I let labview know that the property node contains de parameter "Value".
This way I can dynamic call refnums if it would work.
Althought it worked with invoke nodes.
gr,
06-17-2011 07:21 AM
LV will only allow object of the same type to be assembled into an array.. "All elements of an array can differ only in value" which can be sen if you try to build an array of differnt type of refs, LV will up-cast them to the lowset possible common class.
But there is a special type of data that can be of the same type but differ in the data contents.
LVOOP!
So create a hierachy of LVOOP classes where the private data of each class has the dot net thingy in it.
have fun,
Ben
06-20-2011 03:20 AM - edited 06-20-2011 03:22 AM
I found a way to solve it.
Im not known to LVOOP so think I will stick to this.
Below picture shows how I convert the refnum to a variant and add it to an array.
Parallel to this I also have a string array which contains the position of the corresponding refnum for the search reason.
What I added is a refnum(is a bit masked with "Selector Label" bad screenshot) which corresponds with the constructor, which tell the property node which properties there are.
After this I use the "to more specific class" function. to set the properties corresponding to the constructor's.
Hope I explained it right cos Im not a LV guru.
gr,