Export (0) Print
Expand All

Declared Element Reference

When your code makes reference to a declared element, the Visual Basic compiler matches the name in your reference to the appropriate declaration of that name. If more than one element is declared with the same name, you can control which of those elements is referenced by qualifying its name.

Qualifying a name means preceding it in your source statement with information that resolves any possible ambiguity. Qualifying information can include one or more namespaces, a class, a structure, or a module. In the following example, the Sub procedure SomeSub is declared in more than one place, and the Call statement specifies that the procedure that should be called is the one defined in the module SomeMod in the namespace SomeSpace:

Call SomeSpace.SomeMod.SomeSub()   ' SomeSub is qualified.

In This Section

Reference Matching
Discusses how the compiler matches a reference to a declaration.
Shadowing
Describes the treatment of elements with the same name.
Names in Forms and Controls
Discusses considerations for naming elements within forms and controls.
Name Ambiguity
Discusses ambiguity when programming elements have the same name.

Related Sections

Data Types
Describes the kinds of data that programming elements can hold and how that data is stored.
Variables
Discusses how to declare variables and use them to refer to objects.
Procedures
Describes Sub, Function, and Property procedures, as well as advanced topics such as recursive and overloaded procedures.
Show:
© 2014 Microsoft