Abort LabVIEW VI Programmatically

Updated Nov 29, 2023

Environment

Software

  • LabVIEW

There are instances where stopping your VI is necessary. If you are interacting with your code in the Development environment, you may be able to abort using the Abort button or the Abort keyboard shortcut. However, if you have removed the Abort button from the menu bar, these methods may not work. You can instead abort this VI programmatically by creating a new VI and using the Abort VI method. 
 
Before taking these steps, consider that aborting a VI is similar to "force-quitting" the VI and should be used as a last resort. Instead of aborting VIs, consider more comprehensive error handling and add in logic to safely exit your VI.

This article will demonstrate how to programmatically abort VI execution of another VI. This process only requires LabVIEW, no add-ons needed.

  1. Launch LabVIEW and open a new VI
  2. Place an Open VI Reference on the block diagram. 
  3. Right-click the VI Path input and select Create Control.
  4. Add an Invoke Node to the block diagram. Wire the Open VI Reference output VI Reference to the reference input of the Invoke Node.
  5. Set the Invoke Node to Abort VI by left-clicking and selecting from the methods drop-down list.
  6. Add a Close Reference to the block diagram and wire the VI reference to it. 
  7. On the front panel, click on the Open icon of the vi path control and browse to the filepath of the VI you want to stop.
  8. Make sure the VI you are seeking to close is running. Then, run the VI you just created to stop its execution.
image.png