03-08-2013 04:17 AM
Hello,
I am having a problem using control references to achieve the following: I have a VI that reads in some data from a text file, and then uses that to automatically update the value of a front panel control on two different VIs, then set the values to default and and save them. From the array of control references, I wanted to loop over the text labels until I get the one matching the control I want to change, and then update its value. The problem I have is that if I use a for-loop, then 9times out of 10 LabVIEW complains of Error 1055: "LabVIEW: Object reference is invalid". If instead I wire in index array and manually extract the reference, then it works everytime, and for every index of the control reference.
Can someone take a look over my code and just see if its obvious what the problem is? In this case I have a simple solution, but I would really like to understand what I have done wrong. I included it as a snippet, but also attached the files if that helps (Its Import_Colormap.vi that is the problem). The disabled code fails, the active code works but I can't see what the difference between them really is - I can change the array index 0,1,2,3..and no error.
Thanks.
Solved! Go to Solution.
03-08-2013 07:05 PM
There's no obvious issue with your For Loop.
What is the Label.Text of the control that produces the error?
03-09-2013 01:59 AM
03-09-2013 05:04 AM
Your "Colormap.ctl" is a strict type def that contains a ring. You are setting the items programmatically, make the current values default and then save the "Colormap.ctl"? I have never been practicing this but here is a thread that discusses doing so in detail. I do not understand what you expect to achieve by doing so at run-time.
Next thing: At the same time (in parallel!) you open the Colormap.vi (that is what we can see in yout PNG) which has an instance of the Colormap.ctl on the front panel. I am pretty unsure if LabVIEW can handle this correctly. This might be the reason why you sometimes get the error 1105.
I prefer setting StringsAndValues and subsequently the value for the ring at run-time. There is no need to do it with a strict type def.
03-09-2013 08:51 AM