A module is a set of functions and a set of data members.Code in Visual Basic is stored in the form of Modules. Collection of general procedures, variable declarations, and constant definitions used by application is known as module.
Mainly Visual Basic supports 3 types of modules:
(1) Form module
(2) Standard Module
(3) Class Module
Form modules provide the user interface to the application. They contain controls and properties of the forms. They have the extension .FRM.
Their declaration is private by default, therefore each form has a single form module associated with it.
As we go further in developing the application than there may be common code for execution of several form.
For avoiding the duplication of code, a separate module containing the code is implemented.
This is called as standard module. A standard module (.BAS) contains only code. It contains extension .BAS.
A class module (.CLS) is used to create objects (forms etc.). It can be called from procedures within your application.
Class modules (.CLS filename Extension) are writing code in class modules can create the building blocks of object oriented programming in Visual Basic.New objects.
Each module contains different elements, these are:
It includes constant and procedures.
Sub function or property procedures that contain pieces of code that can be executed as a unit. It avoids code repetition.