For this, the Quit LabVIEW function can be used which is located in the Functions Palette under
Programming » Application Control.
If the Quit LabVIEW function is called within the development environment, it will close the LabVIEW Development Environment. In order to make this function run only in the executable version of the application, it should be enclosed in a Conditional Disable Structure from the Functions Palette under
Programming » Structures.
The Conditional Disable Structure needs to be configured. The steps to configure depend on the LabVIEW version:
LabVIEW 2009 or more recent
LabVIEW 2009 added a conditional symbol that allows the application to determine if it is running inside the development environment or not.
- Insert a Conditional Disable Structure into your code.
- Right-click it and pick Add Subdiagram After.
- In the Symbols(s) field, choose RUN_TIME_ENGINE.
- Leave the center field as ==.
- In the Value(s) field, type True.
- Click OK.
- Move the Quit LabVIEW function into the newly created subdiagram, leaving the Default case empty.
LabVIEW 8.6 or earlier
In LabVIEW 8.6, you must define a custom conditional symbol. Note: To be able to do so, your VI must be part of a project.
- Insert a Conditional Disable Structure into your code.
- Right-click it and pick Add Subdiagram After.
- In the Symbol(s) field, type DEPLOY.
- Leave the center field as ==.
- In the Value(s) field, type TRUE.
- Select OK.
- Choose Project » Properties.
- Select Conditional Disable Symbols in the Category column.
- Create a New Symbol by defining DEPLOY symbol. If you are still developing your application, set the New Value as FALSE. If your application is ready to build, set New Value as TRUE. Note: Before building your executable, ensure that you change the DEPLOY symbol to True in order to enable the Quit LabVIEW function in the deployed application.
- Move the Quit LabVIEW function into the newly created subdiagram, leaving the Default case empty.