From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exiting the VI and closing it with a front panel toggle switch

I am developing a Data logging application by plotting a four channels on a Chart.

What I would like to do is this :

- Like any Windows application, as soon as the user double clicks the short cut to the VI, it should the load VI, run and wait for him to start the plotting for which there is a toggle switch. No problem here.

- And the other toggle switch called "EXIT" when operated, should close the VI application ( equivalent to clicking the "X" button on the title bar.

How to do this LV7 full development system?

Thanks

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 5
(2,564 Views)
There are two ways to do this - the right way would be to use the toggle switch (by the way, why don't you use a stop button?) as a condition for stopping everything that is running in your VI and setting the property "close afterwards if originally closed" to true. The property can be found in File>>VI Properties>>Window appearance>>Customize. This should close the program cleanly and free the memory. The faster and messier way is to connect a case structure to your switch and to place the Exit LabVIEW VI in the true case. The VI can be found in the application control pallete.

___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(2,554 Views)
Oh yes noted both methods and tried out. Problem solved.

Thanks

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 3 of 5
(2,547 Views)
I dont know what I am doing wrong, but it dont works for my VI. When I press stop button, VI stops but dond close.
Attached exe and source files.
0 Kudos
Message 4 of 5
(2,465 Views)
Your situation is different, because you have a toplevel VI. (remember, it says "Open front panel if called THEN close afterwards if originally closed.) A toplevel VI is not "called"!

If you want it to "run when opened", use the checkbox in the execution menu of VI options.

Put a TRUE boolean diagram constant near the right border of your outermost loop, place a "Quit LabVIEW" outside all loops, and wire them together.
0 Kudos
Message 5 of 5
(2,459 Views)