Showing results for 
Search instead for 
Did you mean: 

passing values between different vi's

Go to solution

Simple application. In main VI i click button for new window with subvi. In this subvi i can choose value from menu ring. When i click diffrent button on main VI i want to send what is choosen in subvi, to indicator in main VI. Why this doesnt work?

Download All
0 Kudos
Message 1 of 11

Can you save your code for LV 2012 or earlier?


What I usually do with a popup is wait until the user presses an "ok" button and then close the SubVI. Make the value an output of the SubVI, and wire directly to the terminal on MainVI.


You can also send in a control reference and update via property node.

0 Kudos
Message 2 of 11

In theory, your subVI is still running, so any calls to the subVI while it is running will be blocked.  You should use a Queue or User Event to send data to your subVI.  Look up Queued Message Handler for some good ideas.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 11

I attached version 12. Can you tell me how change it in app?

Download All
0 Kudos
Message 4 of 11

I don't think you should be messing around with call by reference. Just set your SubVI to "open when run" and "close afterward if originally closed".

0 Kudos
Message 5 of 11

I try to set "close afterward if originally closed", but this doesnt help. 😕

0 Kudos
Message 6 of 11

In order to respond the changes to front panel values, the  SubVI launched using VI Server calls must be running in a loop and passing data to any other code that is running in parallel to it. The mechanism to handle passed data could be Notifiers, Queues, *gasp* functional globals, or *gasp* *gasp* global variables. Since you're concerned with only the last value, the recommendation here is a Notifier.


Create a Notifier and pass its refnum to the SubVI that you launch using VI Server calls. The launched SubVI can then write to the Notifier and the Main VI can read from the value from the Notifier.



Feel free. Contact me for anything more,

You too can be LabVIEW Awesome!
0 Kudos
Message 7 of 11

Here is a simple example to show how to use a sub VI to get a user input.



Download All
0 Kudos
Message 8 of 11

... or you have an OK button in the popup and simply connect an output with the value. Or even simpler, you can use the Express VI Prompt user for input for the same effect.


G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
0 Kudos
Message 9 of 11
Accepted by crisdragon


there are many ways how to do that. Check out my modification of you initial example. It really depend if you need non-blocking or blocking dialog window.




Download All
0 Kudos
Message 10 of 11