Abort LabVIEW VI Programmatically

Updated Nov 21, 2018

Reported In

Software

  • LabVIEW Full

Issue Details

  • Need to abort a VI programatically
  • Need to stop the VI from running
  • Cannot use abort button to abort VI
  • Cannot use keyboard shortcut (ctrl+.)
  • Removed the Title Bar and Menu Bar from the Window Appearance category
  • Set the VI to Run when Opened in the Execution category

Solution

Option 1: Drag snipped to block diagram



Option 2: Follow steps
If you would like to close a subVI or another VI running:
  1. Open a blank VI and place an Open VI Reference on the block diagram. 
  2. Create a VI Path control input. On the front panel, you will need to browse to the VI you want to stop
  3. Wire an Invoke Node to the Open VI Reference and set the Invoke Node to Abort VI (Drop down on node)
  4. Wire a Close Reference to the Invoke Node
  5. Wire a General Error Handler to the Close Reference
  6. Open the VI that you want to stop. Make sure it is running and then run the VI you just created. This will stop the first VI
If you would like to close the VI you are working on:
  1. Add an Invoke node and select the VI class and the Abort VI method.
  2. Add a VI Server Reference, make sure it is pointing to 'This VI'.
  3. Wire the VI Server Reference to the Invoke node.
Note: You don't need to close the reference, because you are pointing to the same VI.

Option 3: Use the Stop function.
For more detail on this option, refer to the Help Page for this function.

Additional Information

  • Generally aborting a VI is similar to "force quiting" the VI and should be used as a last option
  • If possible add in logic if needing to safely exit a VI

WAS THIS ARTICLE HELPFUL?

Not Helpful