All Event Handling Is Disabled in an ON ERROR GOTO Handler

ID: Q32272


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
  • Microsoft QuickBASIC for MS-DOS, versions 2.0, 2.01, 3.0, 4.0, 4.0b, 4.5
  • Microsoft BASIC Compiler for MS-DOS and MS OS/2, versions 6.0, 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, version 7.0


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 

Additional query words: VBmsdos QuickBas BasicCom

Keywords :
Version : MS-DOS:1.0,2.0,2.01,3.0,4.0,4.0b,4.5; :6.0,6.0b,7.0
Platform : MS-DOS
Issue type :


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.