Example Code

Close VI Automatically When It is Finished, or Close VI from Remote Panel Control.

Code and Documents

Attachment

Overview

This VI is a simple sine waveform generator that demonstrates how to close the VI Front Panel once the user stops execution

 

 

Description

Sometimes it is useful to have a VI programmatically closed and exit when it is finished.  This will also remove the VI from memory when it is finished executing.  One of the most useful cases of this is if you are connecting to a VI through a Remote Panel.  If you want one button to close the VI on both your Remote Panel computer as well as the Host computer, this VI can be used.

To achieve this follow the below instructions:

1.  Place a VI Server Reference from the Application Control palette on your block diagram and ensure it is set to This VI.

2.  Place an Invoke Node from the Application Control palette on your block diagram.

3.  Wire This VI to the reference input of the Invoke Node VI.

4.  Select the Front Panel»Close method from the Invoke Node.

5.  Place this in a single frame of a sequence structure to run at the end of your VI.

 

 

Requirements

LabVIEW 2012 (or compatible)

 

 

Steps to Implement or Execute Code

1. Download and open the attached VI

2. Run the VI
2. Stop Execution

 

 

Additional Notes or References

Block Diagram

BD.PNG

 

 

 

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

Eric S.
AE Specialist | Global Support
National Instruments

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

Comments
Mr.farmcorp
Member
Member
on

What happens if I call this VI from another VI?, does this VI remove from memory?