Scope

Typically modules are required within a project and are not usually exposed to the external world. Because of this, the default scope qualifier for modules is Friend. But because of their particular nature, modules are also allowed to be Public but neither Private nor Protected/Protected Friend. Members defined within modules can instead be also marked as Private.

About Public Modules

There is a particular exception to the previous discussion: creating a custom extension methods library. Because in Visual Basic you define extension methods within modules, if you want to export such methods, you need to mark them as Public. Extension methods are discussed in Chapter 21, “Advanced Language Features.”

Get Visual Basic® 2010 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.