Note Labels can be used only on executable statements inside methods.
The following lines of code are labeled with Jump and 120, respectively:
120: FileClose (1)
Labels may be either valid Visual Basic .NET identifiers — such as those that identify programming elements — or integer literals. A label must appear at the beginning of a line of source code and must be followed by a colon, regardless of whether it is followed by a statement on the same line.
The compiler identifies labels by checking whether the beginning of the line matches any already-defined identifier. If it does not, the compiler assumes it is a label.
Labels have their own declaration space and do not interfere with other identifiers. A label's scope is the body of the method. Label declaration takes precedence in any ambiguous situation.
To label a line of code
-
Place an identifier, followed by a colon, at the beginning of the line of source code.

Comments
Join the conversation! Your thoughts help the community grow.