LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

generate an error when a user presses a button

I want to be able to give the user the option of exiting the program when ever he wants. I was thinking of having a button that would generate an error. The error number must be unique because i want to read it later. Is that possible? Any help will be appreciated
0 Kudos
Message 1 of 9
(3,362 Views)
Hi,
Yes it is possiable to give a user contolled error message .All you have to do is Create a Constant error control which is passed to the main loop control ,when the user presses a button else not.
Sorry if you do not understand this ,mail me back i shall send you a example.
vicky
0 Kudos
Message 2 of 9
(3,354 Views)
Hi Vicky,


Can you send me the example. Thanks.
0 Kudos
Message 3 of 9
(3,329 Views)
I forgot to give you my email address. alejandro.vasquez@navy.mil
0 Kudos
Message 4 of 9
(3,329 Views)
Hi,
i am attaching the example Vi along with this reply plz check it out,if it does not help you mail me back
vicky
0 Kudos
Message 5 of 9
(3,318 Views)
Good example, but thats not what i was trying to do. I basically want to interrupt my program so it can stop what it is doing and generate an error so i can read later in my closing vi. Attach is an example of what i'm trying to do. The vi has two for loops and a abort button. I want the user to stop the program at anytime even if its in a middle of a loop.
0 Kudos
Message 6 of 9
(3,303 Views)
You cannot exit from a for loop until it is done. Use a while loop instead. Also, using the event structure in this case causes all kinds of exit problems. Try it and you will see what I mean. Instead, use the abort button itself. Put a case statement at the end to give the error output if the abort button was pressed. See attached vi.
- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 9
(3,298 Views)
tbob thanks for your suggestion. But, my program is huge and your suggestion requires to change my code around, i'm trying to avoid that. I just created the for loops so you can get an idea of what i was trying to do. But, you gave me an idea, I was thinking of creating a semaphore when the user press the abort button, and then through out my program check to see if a semaphore was created. If a semaphore was created i can go ahead and generate an error. Does anybody have other suggestions?
0 Kudos
Message 8 of 9
(3,286 Views)
You could use a notifier or an occurance. Might be easier than using a semaphore. Probably the occurance would be the easiest.
- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 9
(3,279 Views)