LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing data in string control

I'm trying to programatically change or delete the data a user has typed into a string control on the front panel of the main vi or reinitialize it to blank default without having to end the vi and run it again.
IE: the user types a lot number into the control, uses controls to run the process, then when the process is complete, I want the Lot number indicator to be blank again so they will have to retype the lot number again before running the process over. LV ver 5.0
0 Kudos
Message 1 of 6
(3,149 Views)
The easiest way to do that is to create a local variable for the control and write a blank string to it when you want to initialize it.
0 Kudos
Message 2 of 6
(3,148 Views)
Hi,
you must use local variables.
Right-click on the control on block diagram. Select "Create->local variable" from drop down menu. The local variable associated with control will aappear. You can use it in any place of your VI to read and write data from/to your control. Place it somewhere and wire an empty string to clear control.

The example is attached.

Good luck.

Oleg Chutko.
Message 3 of 6
(3,148 Views)
The easiest way is to create a local variable of the control and wire an empty string constant to it. Where you put this will depend on how your program is designed. If you've got a cleanup state, it would go there.
0 Kudos
Message 4 of 6
(3,148 Views)
Thanks, that makes sense. Now, what if the String Control is in a sub-vi, but want to clear it from a different sub-vi?
0 Kudos
Message 5 of 6
(3,148 Views)
OK I figured that one out too. I first have to write a global to the local for the control, then write the local to the global, then re-write the global as empty (or whatever) in the different sub-vi when I want it to change.

thanks again for all your help.
0 Kudos
Message 6 of 6
(3,148 Views)