Example Code

How to Save and Read Control Values Programatically

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This example VI show how to write controls value to an ini file and then read them back

 

Description

Have you ever done extensive work on your VI with numerous values only to have someone close it and reinitialize ALL of the values? Well, this VI will solve any problems with that in both the development environment AND and executable evironment.

In the development world, you can go through the hassle of setting current value as default every time you change something, but that is entirely too time consuming. And that option isn't even available in an executable. This method writes the values to an ini file.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Run the program 
  2. Modify control values
  3. Push "write current values to file"
  4. Modify control values
  5. Push "read previous values to file"

 

Additional Information or References

VI Block Diagram

Read Write Control value programmatically LV_2012_NI_Verified.png 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Chris Van Horn
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
alamanna
NI Employee (retired)
on

Hi,

I found this example which could be useful for an SR I took charge of, but:

  • the snippet doesn't work (if I drag it to the block diagram, it is not recognized as code);
  • the attached VIs seem to have nothing to do with the issue presented in the title.

Is there a way to retrieve the correct code without having to rewrite it from scratch, please?

Best regards,

Alessia