Modules Overview

Modules are a specific feature of the Visual Basic programming language. You can think of modules as classes exposing only shared members; each module is defined within a Module..End Module code block. The following code provides an example of a module:

Module Module1    Sub Main()        'DoSomething is a method defined elsewhere        DoSomething()    End SubEnd Module

Differently from Visual C#, Visual Basic does not directly support shared classes; it provides support for classes with only shared members. According to this, the preceding module is the Visual Basic representation of the following class:

Class Program    Shared Sub Main()        'DoSomething is a ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.