Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handler for "Switch, Retry, Cancel"

Status
Not open for further replies.

brandewie7

Technical User
Jan 25, 2004
6
0
0
US
I am looking for suggestions on how to handle the error above. In my application, my code loops while the oia.xstatus <>0, and then waits for a specific string (waitforstring method). Occassionally the string never shows up (an unexpected error). After waiting for a while, an error shows up stating that the system is not responding(something like Switch, Retry, Cancel ?). The only way that I know how to exit the application is to CTL+ALT+DEL. Is there a err number for this? Or does anybody have any work arounds? Thanks for your help in advance.
 
I add a loop to a situation like that that waits only so long for the string. I use a do...loop where I get string up to 5 times. If I never get the string I expect after 5 iterations I have it stop. That way I have an out.
 
I use this code:

Do While .OIA.Xstatus <> 0
DoEvents
Loop

The "DoEvents" statement allows windows to execute the events that are in line. This keeps your system from "locking up" while in the loop.

I also then look to see if the screen changed in a successful query or an unsuccessful event. I then direct the code to the right place.

calculus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top