LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle error created by cancel file dialog?

Solved!
Go to solution
When I open a file using the Programming>>Files>>Adv File Funcs>>File Dialog I get an error if I hit cancel instead of opening a file or folder as expected.  I understand that there is a boolian (Canceled) available as an output of the File Dialog, but I need help figuring out how to use it to stop the event containing the dialog...and avoiding getting an error message.
 
The dialog is contained in an event which executes when I hit a "get a file to analyze" button.  If I don't stop the event from running if the Dialog is canceled, some of the other functions through errors related to Not an image file or the like.
 
Any thoughts?
 
Thanks.
0 Kudos
Message 1 of 20
(10,827 Views)
You basically need to null the error if the dialog is cancelled. For example:



Message Edited by smercurio_fc on 07-25-2008 10:52 AM
0 Kudos
Message 2 of 20
(10,822 Views)

Thanks...will that stop the rest of the event from going forward? ... or do I need to put the file open stuff in one event and the cause an event to handle the successful open of the event seperately rather than trying to handle it all in one event?

Hummin.

0 Kudos
Message 3 of 20
(10,818 Views)

Was little bit wrong answer, sorry. Deleted.



Message Edited by Andrey Dmitriev on 07-25-2008 06:18 PM
0 Kudos
Message 4 of 20
(10,806 Views)

Hummer1,

This is interesting.  If you take the existing example and strip everything down except for the dialog it doesn't error out (Interactive Play Sound File.vi).  If you create a new dialog it does.  Even more interesting I copy the working dialog to the non-working dialog and one works the other doesn't...they look to have the same setting:)  Unless a property node has been changed removed and saved?  To check this (OK I hope your still following me) you can disable one or the other and make the error follow the other non-disabled dialogSmiley Very Happy 

Regards,

-SS

 



0 Kudos
Message 5 of 20
(10,805 Views)

@Hummer1 wrote:

Thanks...will that stop the rest of the event from going forward? ... or do I need to put the file open stuff in one event and the cause an event to handle the successful open of the event seperately rather than trying to handle it all in one event?


I don't know what your code looks like, so I can only provide a general answer. Basically, you can enclose the code after dialog in a case structure driven by the "cancelled" output.
0 Kudos
Message 6 of 20
(10,796 Views)
Solution
Accepted by topic author Hummer1
What about this?
 
Just cancel the error based on error number.  It happens that the error number for cancel is 43.
 
R
 
Message 7 of 20
(10,778 Views)
Still doesn't explain why the file I posted never gets an error when you cancel itSmiley Very Happy  -SS


0 Kudos
Message 8 of 20
(10,771 Views)
You know what SS,  I never saw your file until you just mentionned it..  😮
0 Kudos
Message 9 of 20
(10,768 Views)

@ShotSimon wrote:
Still doesn't explain why the file I posted never gets an error when you cancel itSmiley Very Happy  -SS

You do get an error. Put an error out indicator on the output. You've probably got automatic error handling turned on. As to why that's not triggering, I can't say - I never use that automatic error handling stuff.


Message Edited by smercurio_fc on 07-25-2008 02:29 PM
Message 10 of 20
(10,761 Views)