LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Aborting the operation of writing to a file

Hi

I need to write some data stored in an indicator in labview 7.0 to a file.The location of the file is to be specified by the user. In order to prompt the user to enter the name and location of the file, I am using the "File Dialog" function from the functions palette. While running the program, if the user selects the cancel button on the dialog box that is prompted, the program shows an error and terminates the execution of the program. I want my program to not show an error when the cancel button is selected and it should just not save anything rather than terminating the execution of the program.
Can someone please help me?
0 Kudos
Message 1 of 3
(2,713 Views)
The file Dialog has 3 outputs : one is the file path, the others are booleans values indicationg the operation has been cancelled, and that the selected file already exists.

Simply put the file saving operations in a case structure, and wire the case input to the "Cancelled" output.
Managing the "File exists" is more annoying : You will have to dig one level below the Write characters to File.vi, or whatever high level file save you are using, to
change the value of the "Advisory dialog?" constant input of the Open/Create/Replace File.vi, to avoid an annoying dia
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 3
(2,712 Views)
...to avoid an annoying dialog box.
Then it is your responsibility to manage the user decision of rewritting or not over existing files...

See the attached vi.

CC

ps sorry for the double post, but some commands on the new interface are far from an optimal position !
Chilly Charly    (aka CC)
0 Kudos
Message 3 of 3
(2,710 Views)