Home

Contents

Web-Based Training

Research

VB

 

Modules in Visual Basic

 

Modules are containers for procedures and, at this writing, come in three varieties: Form modules, Standard modules, and Class modules.

--------------------------------------------------------------------------

Index of Page Topics

Form Modules

Visual Basic

Standard Modules

Subroutines

Class Modules

References

----------------------------------------------

Form Modules

Each form (or page) has its own objects and its own set of potential events and procedures. Each form also has its own container or package of procedures, a form module. If there is only one form in a program package, all of the procedures are contained in it.

Back to Index

 

----------------------------------------------- 

Standard Modules

In addition to form modules, there are also standard modules, currently so-called. (They've been called code modules.) When different forms in an application use exactly the same code, repeating the code only increases storage requirements, so it's generally best to put the code in a separate module, one that can be accessed from any form module. This separate container is the standard module. Each chunk of application-wide common code (subroutine) has its own standard module.

Back to Index

----------------------------------------------

Class Modules

Forms (form modules) are class modules that display a form window on which you can put normal controls. Almost everything that applies to class modules applies to form modules.

Class modules let you write code to generate new objects, which can have special properties and methods (but not events, for then you would have a form and therefore a form module). The properties and methods can be used by other objects in an application.

Back to Index

--------------------------------------

Top of Page