08-08-2023 12:09 PM
I'm hoping you all will be able to help me figure this out as all the other solutions I've found in these forums includes one key component that is not desirable for me.
I am trying to change the default value of a control (actually a group of controls but looping each one singularly) and allow the user to save said default value so that the build itself doesn't need to be re-built and republished each time this value changes, while not requiring the value to be changed each time the program is ran later on in the future.
The problem is that not every control is changed and some that are changed are not included in this "set" of controls to have their default value changed. For example, this save action could happen while the user has input a serial number string into another input text box. The solutions I've seen utilize the full VI "Default Vals.Make Curr Default" invoke node which of course would work great for the controls the user changed but it would then make this serial number the default for the input text control also, which is not desirable.
Thus I need a method to take a refnum of a specific control and set its default value to its current value programmatically. Obviously the user cannot right click the control on the front panel and set it to default because they are running a built and published .exe. (unless I'm wrong and this actually is an option). Right now I have an array of the validated and supported references to the controls I want to change the default value of, but no property or method node I can find in the list interacts with default values at all.
In fact the only default values node I can find is the one mentioned above with regard to the whole VI.
Surely if there is an option for me to graphically right click a single control and make its current value default (which has no effect on any other control) there should be a way to complete that same task programmatically?
Solved! Go to Solution.
08-08-2023 12:36 PM
You can't change the default value of a control in a built executable. You will need to explicitly save the values from the controls to a configuration file, then explicitly load them from a configuration file when the program starts.
Look at the INI configuration file manipulation VI's. They're part of LabVIEW and don't require you to download any other toolkits. They're very easy to use.