05-17-2022 06:29 PM
I have an application that is using a .NET dll which contains the following declaration and function call.
Where variant is a declared as a public struct with 40+ overloads.
And VUInt64, as well as others, are defined as follows.
In labview 2020 I have made the call as follows
Where result and the param# property nodes were created from the function call, (i.e. right click on result, param1, ... and select create Property for SDK.CSWrapper.Variant Class.) Then create control from that property noted. (Right click, create control). LabVIEW seems happy enough with this but when it is run it errors these property nodes. Error 1172 [SDK.CSWrapper.Variant.VUnit64 (System.ArgumentNullException: Key cannot be null. Parameter name: key)]. I see that the value of result leading to the property node is 0000. So presume that I did not either create the control properly though can see all the possible values (overloads) defined under the variant declaration when I access the property. Hopefully just missing the obvious and the error is telling me but I'm not seeing it.
Solved! Go to Solution.
05-17-2022 08:48 PM
You can't just use "Create control" to make an input for those, you need to create a constructor node.
"Create control" creates the correct type of wire, but that is all it does. It doesn't put a value on it... you need to pass that in from somewhere else. Hopefully you can create a constructor node of the types you need in LabVIEW. If not, you might need to create a valid object in a custom .NET DLL, pass it to LabVIEW where it can then modify it, then pass it to the function in question you need to call.
05-18-2022 06:26 AM
Just to add to that, if you put a probe on one of those variants, you'll see the reference is 0.
Unless of course you use this VI as a subVI, and pass valid references to the controls as inputs...
Also, don't forget to close all those references.
05-18-2022 07:51 AM
Thanks Kyle for your quick reply. made the constructor from the top level Variant then the property node to select which type.