All Event Handling Is Disabled in an ON ERROR GOTO Handler (32272)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0

This article was previously published under Q32272

SUMMARY

All event handling is suspended in an ON ERROR GOTO handler. The following types of events are suspended during an error trapping routine:

  1. Key trapping (ON KEY(n) GOSUB)
  2. Timer (ON TIMER(n) GOSUB)
  3. Communications (ON COM(n) GOSUB)
  4. Light Pen (ON PEN GOSUB)
  5. Joy Stick (ON STICK GOSUB)
  6. User-defined event (ON UEVENT GOSUB)
These events are enabled again as soon as the error trap is exited with a RESUME or RESUME NEXT statement.

MORE INFORMATION

The following code sample demonstrates this type of behavior:
   ON ERROR GOTO trap
   ON KEY(1) GOSUB keytrap
   KEY (1) ON
   ERROR 5    ' Forces an error 5.
   END
				

trap:

     PRINT "In the error trap, enter F1"
     while inkey$=""
     wend
     RESUME NEXT
				

keytrap:

     Print "A key as pressed"
     return
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB32272