LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set or Load Constant to a Control at the Start of a Program

Solved!
Go to solution

Hello,

 

I would like to read use the "Scan From File" to load or set a control with a specific value when I press the run button to start the program.

Once the program is running, the user can change the control to another number.

The constant in the file read by "Scan From File" should not change. 

 

For instance, I would like to wire the first "DBL" output from "Scan From File" to the Voltage Interval control.

I have the "Scan From File" set up, but when I try to wire an output from the "Scan From File" to my conrtol, it gives the error "Wire connected to a unidirected tunnel"

 

Should I use "Select" to do this? It's will be messy though becasue I have a bunch of constants I want to set. Any other ideas? Or a solution to my main question?

 

Cheers

0 Kudos
Message 1 of 3
(2,648 Views)
Solution
Accepted by topic author RafP

You need to wire to either the local variable, or the value property node, of the control that you want to programmatically set the value for.

 

(The message is "undirected tunnel".)

Message 2 of 3
(2,646 Views)

Thanks for the tip. It worked perfectly.

 

I made local variables for each control I had. I put my "Scan From File" and all control local variables outside of my main while loop, so when I first press run, the constants from my text file are loaded into the controls. Then, while the program runs, I can change the control values, while still keeping the constants safe for when I rerun my program again later.

 

Thanks again! 

0 Kudos
Message 3 of 3
(2,623 Views)