I'm working on a small C# program, which using the interface provided by LabVIEW. And I know that, using lv.SetControlValue(name, value) can set a variable just on the front panel. But in my case, there're several clusters on the front panel. So it confused me how to set the variables in these clusters. For example there's a cluster named clusterA, and a variable in it named valueA, I've tried something like this:
lv.SetControlValue("clusterA.valueA", 1);
But it totally not work. Anyone has some experience about this stuff?
thanks a lot for all your reply. I just find a simply way to solve this problem. For example, there a cluster named ClusterA, and there are only two control values in it, which are: an int value named "IntA" (default value IntA = 10)and a string value named StringA (default value StringA = "abc"). In C# if you invoke the method:
var clusterA = (Array) vi.GetControlValue("ClusterA");
you will get an Array looks like: clusterA = {10, "abc"}; Then if you want to change IntA to 123, you just need to do:
clusterA.SetValue(123, 0);
// 123 is the value, 0 is the index of IntA in the array clusterA
// after this clusterA = {123, "abc"}
After this, you just need to give the array back to LabVIEW by using:
vi.SetControlValue("ClusterA", clusterA);
and now see the panel in you LabVIEW, the IntA is changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With