LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close Reference (To a more specific class)

Solved!
Go to solution

I am feeding a control reference to the "to more specific class" node.  When I am done, I understand that I need to close the control reference, but do I also need to close the reference which is the output of the "to more specific class" node?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 4
(3,177 Views)
Solution
Accepted by topic author jyang72211

It's the same reference...there's no need to close both.  And if you trust LabVIEW's automatic cleanup of references, you really don't need to close either, as control references should never be duplicated, and will be automatically cleaned up when your VI goes idle.

 

For more information, here's a blog post I wrote a while back that talks about closing references.

Message 2 of 4
(3,174 Views)

That's a great resource.  I have a question on it.  when you have an array of control references, how would you know which one you are interested in without using a while loop to search through each elements of the reference array?  For example, I have a array of references for all my controls on my main vi front panel, and I am interested in the reference for numeric3.  How do you find that reference without looping through each label?  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 4
(3,170 Views)

If you have the reference for Numeric 3, why do you want to figure out which index it is into the control reference array?  I'm assuming you only have the label of Numeric 3.  In this case, you do need to loop through the references, but For Loop With Break makes this pretty efficient:

 

matchlabel.png

 

Add logic as necessary for error handling, case insensitive matching, returning a flag if the control isn't found, etc. etc.

Message 4 of 4
(3,167 Views)