On Gosub or On Goto Causes Error: Variable not declared

ID: Q95481


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


SYMPTOMS

Using On expression% Gosub or On expression% Goto control flow statements in a program that uses Option Explicit, incorrectly causes the following error when compiled using the BC.EXE compiler:

Variable not declared
This does not occur with a program running under the VBDOS.EXE interpreter environment.


WORKAROUND

To work around the problem, either remove Option Explicit or use a different control flow method.


STATUS

Microsoft has confirmed this to be a bug in both the Standard and Professional Editions of Microsoft Visual Basic version 1.0 for MS-DOS. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

Steps to Reproduce Problem

  1. Start VBDOS.EXE.


  2. Type in the following into the Code Window:
    
          Option Explicit
          On 1 Goto Label
          Label: 


  3. From the Run menu, choose Make EXE file, and then choose the Make EXE button.


Notice that the error "Variable not declared" is displayed in the output screen. To allow the program to compile, remove the Option Explicit statement or use a different control flow statement such as Select Case.

Additional query words: VBmsdos buglist1.00 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.