Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Modules and Procedures
◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Modules and Procedures
■ Visual Basic uses two kinds of modules, form modules and code modules:
• Form (.FRM) modules contain data declarations, event procedures, and
general procedures. In addition, form modules contain the visual
description (objects and properties) of a form.
• Code (.BAS) modules contain data declarations and general procedures.
See: ◄Creating a General Procedure►
■ Event procedures in a form module should be written only for those events
to which you want a form or control to respond.
See: ◄Creating an Event Procedure►
■ Visual Basic provides several keywords used specifically to write code for
modules and procedures. See: ◄Subs, Functions, and Procedures►
■ Variables can be either shared by form or code modules using the COMMON
SHARED statement, or passed to procedures by reference or by value
(BYVAL). See: ◄Scope Rules► ◄By Reference Vs. By Value►
■ A new module is created when you choose either New Form or New Module from
the File menu:
• New Form adds a form module (.FRM).
• New Module adds a code module (.BAS).
■ Form modules are private: Event and general procedures within form modules
cannot be called from external modules or procedures. Executable code is
not allowed at the module level of a form module.
■ Code modules are public: General procedures contained within code modules
can be called from other modules or procedures. Executable code is allowed
at the module level of code modules.
See: ◄Building an Application► ◄Module Definitions►