How Do I Change Default Values While My LabVIEW Program is Running?

Updated Nov 7, 2023

Reported In

Software

  • LabVIEW Professional
  • LabVIEW Application Builder Module

Issue Details

  • I've created an executable in LabVIEW and want to change the default values of the controls, and the Data Operations»Make Current Value Default option is not available. How can I set and change the default values of the controls?
  • I would like to set default values for my controls during program execution. However, I cannot run the Make Current Value Default method during execution. How can I effectively create default values for my program that can be updated during execution?

Solution

You can effectively change the default values in your LabVIEW executable by using the Configuration VIs palette to read and write to a .ini file. The configuration shipping examples in LabVIEW 2009-2012: Read Configuration Settings File VI and Write Configuration Settings File VI show how this is accomplished. These can be found by navigating to the NI Example Finder, and then clicking on Fundamentals»File Input and Output. The examples in LabVIEW 2013-2018 are contained in the Configuration (INI) project: The Configuration (INI) project can be found in the NI Example Finder under Fundamentals»File Input and Output»Configuration (INI)

Additional Information

  • You can find the Configuration VIs palette under Programming>>File I/O>>Config File VIs in the Functions Palette on the block diagram of a VI.
  • The Make Current Value Default function is only available while editing a VI. Default values cannot be changed while a program is running. The solution provided here is a workaround for effectively creating default values.
  • Metadata other than default values for controls can be saved in .ini files for easy access. Any data that can be stored in a key-value pair format can be used with a .ini file.
  • Default values can also be saved by writing them to a text or .lvm file if you choose not to use the Configuration VIs. This has been demonstrated in NI Community: How to Save and Read Control Values Programmatically . The examples show how a user can use the Read from Measurement File VI alongside the Write to Measurement File to save the values of the controls. The values of the controls are merged together and saved to a specified file path. The user can then choose to read from that file the next time the VI is opened.