Using Modules

Like classes, modules serve as containers for variables, functions, and subroutines. You can’t, however, create an instance of a module the way you create an instance of a class. You just use the contents of a module "as is" and "in place." Everything you put in a module is, by default and not subject to change, Shared.

Modules are excellent places to put data or procedures that need to be available to your entire program, and that don’t need the replication or protection features of classes. Just remember that the penalty for overusing shared data is code that you can’t easily use in more than one program. Self-contained classes are much more portable.

To add a module to your project, select Add New Item from the File menu. When the ...

Get Faster Smarter Beginning Programming 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.