Scope of Line Labels/Numbers in Visual Basic for WindowsLast reviewed: June 21, 1995Article ID: Q78335 |
The information in this article applies to:
- Standard and Professional Editions of Microsoft Visual Basic for Windows, versions 2.0 and 3.0- Microsoft Visual Basic programming system for Windows, version 1.0
SUMMARYLine labels (and line numbers) do not follow the same scoping rules as variables and constants in Visual Basic for Windows. Line labels must be unique within each module and form. However, you can only transfer control to a line label or line number within the current Sub or Function.
MORE INFORMATIONWhen you attempt to define the same line label twice within a module or form, you receive the error message "Duplicate label". This message means that the label is already defined in another procedure within the current module. When you use a GOTO or GOSUB statement that names a line label defined in another procedure, you receive the error message "Label not defined." This message means that the label is not defined in the current Sub or Function. For more information about line labels, see the description of the GOTO and GOSUB statements in the "Microsoft Visual Basic: Language Reference" or in the Visual Basic for Windows online Help system.
|
Additional reference words: 1.00 2.00 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |