Error: Executable code not allowed in module level of a form

ID: Q94695


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0


SUMMARY

You can't use the On Error Goto and On Event Gosub statements in a form because they require an event handler at the module level, and you can't enter code at the module level of a form.

Attempting to enter code at the module level of a form results in an error:

Executable code not allowed in module level of a form
Line labels and line numbers are allowed in the module level of a form module, but they are useless.

To work around this limitation, use On Error and On Event statements only in code (.BAS) modules or use the On Local Error statement for error trapping.


MORE INFORMATION

This limitation applies to the following statements:


   On Error       On Com
   On Key         On Pen
   On Play        On Strig
   On Timer       On UEvent 

Additional query words: VBmsdos 1.00

Keywords :
Version : MS-DOS:1.0
Platform : MS-DOS
Issue type :


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