Message 1 of 9
cancel program within error handler?
Not applicable
09-26-2001
06:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
(sorry if there was a duplicate post)
I was wondering if there is a way to get VB to recognize when the ESC key
is hit.
Normally it does, but I have an error handler that repeats a sequence of
code, just in case the user doesn't pick an object with GetEntity.
RETRY:
On Error Resume Next
ThisDrawing.Utility.GetEntity Line1, dummyPoint, "Pick the line to test
for intersection:"
If Err <> 0 Then
If Err = 13 Then
Err.Clear
ThisDrawing.Utility.Prompt "Invalid Object. "
GoTo RETRY
End If 'Else no object was picked (probably)
Err.Clear
ThisDrawing.Utility.Prompt "No object picked. "
GoTo RETRY
End If
On Error GoTo 0 'Turn off error trapping
Hitting the escape key just causes it to jump back to RETRY.
I figured I could put some code in the error handler that recognizes that
the ESC key is down and end the program from there. Otherwise the only way
to end it is to pick a valid object (if one exists) or hit stop from the VB
IDE.
Any help would be appreciated!
Thanks,
Jason
--
I was wondering if there is a way to get VB to recognize when the ESC key
is hit.
Normally it does, but I have an error handler that repeats a sequence of
code, just in case the user doesn't pick an object with GetEntity.
RETRY:
On Error Resume Next
ThisDrawing.Utility.GetEntity Line1, dummyPoint, "Pick the line to test
for intersection:"
If Err <> 0 Then
If Err = 13 Then
Err.Clear
ThisDrawing.Utility.Prompt "Invalid Object. "
GoTo RETRY
End If 'Else no object was picked (probably)
Err.Clear
ThisDrawing.Utility.Prompt "No object picked. "
GoTo RETRY
End If
On Error GoTo 0 'Turn off error trapping
Hitting the escape key just causes it to jump back to RETRY.
I figured I could put some code in the error handler that recognizes that
the ESC key is down and end the program from there. Otherwise the only way
to end it is to pick a valid object (if one exists) or hit stop from the VB
IDE.
Any help would be appreciated!
Thanks,
Jason
--