Module...End Module Statement


Module...End Module Statement

Syntax

     [accessModifier] Module name        [statements]     End Module 


accessModifier (optional)

Specifies the scope and accessibility of the module. One of the following access levels:

Access level

Description

Public

The module is publicly accessible anywhere, both inside and outside of the project.

Friend

The module is accessible only within the project that contains the module definition.


If omitted, the Friend access level is used.


name (required)

The name of the code module.


statements (optional)

Code that defines the members of the module.

Description

The Module...End Module statement defines a code block as a code module. A module is similar to a class where every member is Shared by default. Modules may contain fields, properties, methods, events, and other types.

Usage at a Glance

  • Modules may not be nested, nor may modules inherit from any other type.

  • Since all members of a module are essentially Shared, modules cannot be instantiated as objects.

Version Differences

The Module statement is new to VB under .NET, but the idea of a module was always part of Visual Basic. VB 6 placed each code module in a separate BAS file, which rendered beginning and ending statements unnecessary. A single VB source code file in .NET, on the other hand, can contain multiple code modules and other types.

See Also

Class...End Class Statement




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net