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: 

cancel button problem

I am using the Active X common dialog to make a file path with options for writing .xls and .txt files. I also ad time and date to the filename.

I now want to know when a user presses the cancel button while in the save as menu. I cannot figure out how to do this. Does anyone know?

I have added my .vi(wich is a modified version from another forum poster)
0 Kudos
Message 1 of 5
(2,378 Views)
You should be able to see if cancel was pressed by checking the path output. If it's blank then the user pressed Cancel, if not they pressed Save. This is demonstrated in the attached example, which is my original example modified by Mikael Garcia.

Or if you set the property "CancelError" to true then an error will be generated in the Error Out terminal of the invoke node containing "ShowSave". See the other attached file to see this.

BTW, you can't have slashes "/" in windows file names, as your example was set up.

Good luck!

Brian
Download All
Message 2 of 5
(2,378 Views)
Thanks Brian! I realized that the VI I created some time ago with your help did not provide a default file name. If a default name is added, the Cancel detection using the file path fails. That is why your suggestion with the "CancelError" setting here is very useful. I changed my VI accordingly and attached it to this comment. /Mikael
0 Kudos
Message 3 of 5
(2,378 Views)
Ah... I did not check the filename output when a default name is provided. So then yes, the "CancelError" method is the only way to go. Thank you for pointing that out.

Brian
0 Kudos
Message 4 of 5
(2,378 Views)
Thank you all for replying!!
problem solved, thanks again,

Rogier.
0 Kudos
Message 5 of 5
(2,378 Views)