LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need to cancel read/write file without terminating the program ( error 43 occurred at File Dialog )

I'm using both Write/Read to/from XML File.vi in my program to load and save test configs.  However, let's say when the program open the prompt to ask for filename to save to, the user change his/her mind and click cancel.  In this case I just want the program to resume and not prompt me with "Error 43 occurred at File Dialog; Operation canceled by user" then unwanted terminate the program.

thanks,
Anh
0 Kudos
Message 1 of 5
(4,221 Views)
Hi
 
Basically, if you use a separate vi to select the file, there usually is an output "cancelled". Wire this to a case structure, where the xml vi is in the false case.
 
If this does not solve your problem, post a picture of your code or the vi itself, so that we can have a look at it.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 5
(4,210 Views)
If you look at the "Open/Create/Replace File.vi", then there is output called as "Cancelled". You could use this boolean output to filter our the error codes by using a case structure.
Refer to the image below:
 
 
Regards,
Chetan K
Application Engineer
National Instruments
 

Message Edited by CKap on 11-30-2006 11:08 AM

0 Kudos
Message 3 of 5
(4,199 Views)
This is probably not the right way to do this, but i wire up a simple error handler to the output of the vi and specify a no message constant.  It has always worked for me with no problems.
Mark Mutton
Electrical Engineer
0 Kudos
Message 4 of 5
(4,188 Views)
Thanks all for answering.  I use "Read From XML File.vi" and it does not have the "output cancel" option.  However, I found a bug in my VI that causes the error to occur.  Basically, it won't show the error prompt when I got the "error out" connect to the next "error in" until the end of the error flow.  I then handle the error at the last error out.

thanks,
Anh
0 Kudos
Message 5 of 5
(4,177 Views)