LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control/file references closed and reused

Solved!
Go to solution

See attached example.  I realized that you can reuse a control reference even after it is closed, and this does not applied to file reference.  Why is that?  

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

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 6
(3,259 Views)

I didn't look at the example, but the general answer is simple - a control reference simply points to an existing control. As long as the control is still around (because LV keeps it around), closing the reference does nothing, because LV still needs it and it knows that.

 

A file reference, on the other hand, is something that you create yourself. Closing the reference also releases all the resources used by that reference, making it invalid. The same would apply to other type of references, such as DVRs, queues, TCP refnums, etc.


___________________
Try to take over the world!
Message 2 of 6
(3,251 Views)

...adding to Yair's reply...

 

The control refs you are looking at are static and do not change and are valid as long as the app is open and running. THere are some control refs that are dynamic and have to be handled the same way as the file.

 

Done adding.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 6
(3,243 Views)

If that's the close, why do we have to close the control reference with the Close Reference node?  

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

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

Only the dynamice refs need closed, see here.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 6
(3,231 Views)

Perfect.  Thanks!

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

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