10-24-2021 03:43 AM
Hello all.
I am working on a data acquisition software where a user inputs different configuration data (which he may change at any point of time) like minimum and maximum temperature/pressure/rate, COM port etc. Please find the attached image of the GUI which I am doing in tab control format.
Now what I want is, suppose if the power goes off and the program restarts, it should load the last values of configuration settings updated by the user. One possibility I find is that we can store the various configuration data into a file and when the program reruns, it will fetch and load the corresponding data from the stored file. I am getting confused over this. Can somebody please tell me how to achieve this?
10-24-2021 09:13 AM
@rajesh111 wrote:
One possibility I find is that we can store the various configuration data into a file and when the program reruns, it will fetch and load the corresponding data from the stored file. I am getting confused over this. Can somebody please tell me how to achieve this?
What are you confused about? That is exactly what you need to do. The real question is what format to save the data in. I would probably use a JSON file. I know a lot of people who would use a SQLite database.
10-24-2021 02:00 PM
Look up the examples for configuration files in the Help menu.
You can write a starting INI file using Notepad. It saves you having to code the initial file creation. You can then read the configuration file and even modify it through your application.
More info here: https://zone.ni.com/reference/en-XX/help/371361R-01/glang/configuration_file_vis/
10-24-2021 03:49 PM - edited 10-24-2021 03:50 PM
Save the configuration in a file and reload it when the program starts up.
I prefer XML for complex configuration settings, but in your case a simple text file would suffice.