Anyone can tell me what is a module actually?
how it differs from others files?

Recommended Answers

All 9 Replies

this is from Madboy of VBForums

What is a module you ask? A module is used to store all your functions and public routines seperately. Apart from it keeping your code editors window clean, it removes the need for repetitive typing. For example, it is better to add code to a module and use 1 line to call it when needed, then to repeat the same code over and over. This code from the module Exits the program when needed:

Public Sub ExitProgram()
Unload frmMain
End Sub

It has to be named Public so VB knows it is available to all forms. Now, from the form, this code is called when you click either the File > Exit menu item or the Exit Command button, like so (This code goes in your form's code window):

Private Sub mnuFileExit_Click()
Call ExitProgram
End Sub

Private Sub cmdExit_Click()
Call ExitProgram
End Sub

Although there is no significant size difference in using the code form the module, as there is using it in your form's code, it saves time and space later on when dealing with larger code!

variables and functions that are used throughout your program and on different forms can be stored in modules so that not to rewrite again each time the variables and functions when you need them in a form.

Modules are a way to declare objects at one palce and access them globally.

Modules are a way to declare objects at one place and access them globally.

yes, absolutely like debasisdas. modules helps u to declared globally function, procedure, variable, etc. so you didn't have to declare them again in every form.

hello guys,im beginner in vb programming, im making a simple POS system that can connect to ms access, im having problem to make it work in the transaction form , wha i need is when i input the product code the description and price from database will appear to their text boxes,please help me... do i need to declare new recordset again if i have more than 1 table in database?Im using Adodb in visual basic 6.0, please help, thanks

A module contains the procedure and functions that put the code into operation.

Code in visual basic is stored in the form of modules. The three kinds of modules are Form module,Standard module, and class modules. A simple application may contain a single form and the code resides inthat Form module itself. As the application grows, additional Forms are added and there may be a commoncode be to executed in several Forms. To avoid the duplication of code, a separate module containing a procedure is created that implements the common code. This is a standard module.Class module is a foundation of the object oriented programming in visual basic. New objects can becreated by writing code in class modules. Each module can contain variable declaration or procedures.

Can anyone explain me how to use the modules?

you'll need to create your own thread.
there we will try to solve your problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.