A standard module is a type whose members are implicitly Shared and scoped to the declaration space of the standard module's containing namespace, rather than just to the standard module declaration itself. Standard modules may never be instantiated. It is an error to declare a variable of a standard module type.
A member of a standard module has two fully qualified names, one without the standard module name and one with the standard module name. More than one standard module in a namespace may define a member with a particular name; unqualified references to the name outside of either module are ambiguous. For example:
Namespace N1
Module M1
Sub S1()
End Sub
Sub S2()
End Sub
End Module
Module M2
Sub S2()
End Sub
End Module
Module M3
Sub Main()
S1() ' Valid: Calls N1.M1.S1.
N1.S1() ' Valid: Calls N1.M1.S1.
S2() ' Not valid: ambiguous.
N1.S2() ' Not valid: ambiguous.
N1.M2.S2() ' Valid: Calls N1.M2.S2.
End Sub
End Module
End Namespace A module may only be declared in a namespace and may not be nested in another type. Standard modules may not implement interfaces, they implicitly derive from Object, and they have only Shared constructors.
ModuleDeclaration ::=
[ Attributes ] [ AccessModifier+ ] Module Identifier LineTerminator
[ ModuleMemberDeclaration+ ]
End Module LineTerminator
See Also
7.7.1 Standard Module Members |7.1 Value Types and Reference Types | 7.3 Primitive Types | 7.4 Enumerations | 7.6 Structures | 7.5 Classes | 7.8 Interfaces | 7.9 Arrays | 7.10 Delegates | Module Statement (Visual Basic Language Reference) | Classes vs. Standard Modules (Visual Basic Language Concepts)