Scope of Line Labels/Numbers in Visual Basic for Windows (78335)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 2.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 2.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
- Microsoft Visual Basic Standard Edition for Windows 1.0
This article was previously published under Q78335 SUMMARY
Line 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 INFORMATION
When 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.
Modification Type: | Major | Last Reviewed: | 12/12/2003 |
---|
Keywords: | KB78335 |
---|
|