Microsoft KB Archive/95481

= On Gosub or On Goto Causes Error: Variable not declared =

PSS ID Number: 95481

Article Last Modified on 1/8/2003

-

The information in this article applies to:


 * Microsoft Visual Basic for MS-DOS 1.0

-



This article was previously published under Q95481



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.



Steps to Reproduce Problem
 Start VBDOS.EXE.  Type in the following into the Code Window: Option Explicit On 1 Goto Label Label:  From the Run menu, choose Make EXE file, and then choose the Make EXE button.

Notice that the error &quot;Variable not declared&quot; 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: KB95481

Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.