Example Code

Programmatically Opening and Running One VI from Another Using VI Server

Code and Documents

Attachment

Download All

This simple example uses a pair of VIs to demonstrate how to use VI Server to programmatically open and run one VI from another. Run This.vi to open and run That.vi.

This.vi will programmatically open and run That.vi, using VI Server. Unlike a subVI, That.vi will run independently of This.vi, with control being returned to This.vi immediately.

Note: You would only make a call to That.vi once (i.e., don't use a while loop to control it), unless you know that it has stopped running, in which case, you can call it again.

The front panel of That.vi contains a chart that displays randomly generated numbers. Since That.vi runs independently of This.vi, you must press the Stop button on the front panel of That.vi to halt its execution.

If you are using LabVIEW 7.1 or later, download the file name porvisv71.zip.  Use porvisv.zip if you are using LabVIEW 5.x or 6.x

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

Contributors