Chapter 10. Modules

Visual Basic programming language provides a simplified way for working with shared classes. Modules have been a part of Visual Basic since the beginning, so it is the real reason why Visual Basic .NET has modules versus C# which has shared classes. In this brief chapter you learn about the module feature.

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 ...

Get Visual Basic® 2012 Unleashed, Second Edition 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.