LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to keep some values till next program run?

How exactly can I make my app 'remember' some of the controls values till next program run?

0 Kudos
Message 1 of 7
(3,275 Views)

Are you running in development or as an executable?

 

In development, you can use the invoke node to make the current values default.  That way, they'll be the default values on next open.  You can also right-click the controls/indicators and choose the same option under data operations.

 

In either setup, you can build an ini file.  Save the values you want to retain in that file and start your application by initializing all of the controls/indicators to these values.

Message 2 of 7
(3,263 Views)
This white paper gives a lot of good information about the configuration files Natas mentioned

http://www.ni.com/tutorial/3478/en/
Matt J | National Instruments | CLA
Message 3 of 7
(3,222 Views)
Here you can find a few more ideas.

http://www.notatamelion.com/2015/06/22/helping-a-window-to-remember/

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 7
(3,193 Views)
Thank you all guys!
0 Kudos
Message 5 of 7
(3,156 Views)

Sometimes, when I need a quick solution for this, I just put all needed data in a cluster and save it at program exit in XML file. The XML functions from the File I/O/XML/LabVIEW Schema functions palette, or the GXML library, can be used.

Then, at program start, you can read this file, if it exists (which is not true at the very first start). I usually save this file in the applications directory, in order to keep it simple.

Message 6 of 7
(3,052 Views)

@chembo wrote:

Sometimes, when I need a quick solution for this, I just put all needed data in a cluster and save it at program exit in XML file. The XML functions from the File I/O/XML/LabVIEW Schema functions palette, or the GXML library, can be used.

Then, at program start, you can read this file, if it exists (which is not true at the very first start). I usually save this file in the applications directory, in order to keep it simple.


 

I've had some weird stuff happen with saving all my data as one big XML string and reading it back in. I think this happens when I have an array of Variant data in my cluster? It's been a little while since I've had the problem, so I can't recall what my fix was. I think some of the syntax just gets messed up when you have an identical data type as the one to which you're flattening. 

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 7 of 7
(3,032 Views)