From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I avoid refnum no longer valid?

Was hoping someone may have a suggestion...I mentioned previously I use VI scripting to create a bunch of controls and indicators from a text file.  Along with that, it stores a reference number for each control in an array.  I copy these controls/indicators to a separate VI, then register the contents of the refnum array with dynamic event registration, the goal being that a value change on any of the controls will trigger the event structure.

 

I started testing and found that the contents of the refnum array, although valid when I began testing, changed to "Refnum no longer valid" after I closed the VI.  I guess this makes sense...I guess what I need in my case is effectively an "absolute refnum", basically a single reference that will be associated with a control at all times, and will persist regardless through program execution and shutdown.  Do such references exist?  The only other alternative I can think of right now would be to build the array of references at runtime each time, but I'm not sure how I would do that...things are put in the array in a specific order when I run the VI script, so right now I don't see any way that I could re-capture that order by building the array at runtime (i.e. through some use of Scan for GObjects VI that finds each control one by one and gets a reference to it).

 

Surely there's an easier way to make it persist?

 

0 Kudos
Message 1 of 2
(2,470 Views)

Hi bmishoe,

 

Please refer to this forum. 

 

Refnum is No Longer Valid - Discussion Forums
https://forums.ni.com/t5/LabVIEW/Refnum-is-No-Longer-Valid/td-p/539259

 

Thank you

0 Kudos
Message 2 of 2
(2,427 Views)