1,105,169 Community Members

What is Modules (in VB6)

Member Avatar
masakii
Newbie Poster
4 posts since Mar 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
cometburn
Junior Poster
122 posts since Feb 2008
Reputation Points: 2 [?]
Q&As Helped to Solve: 19 [?]
Skill Endorsements: 0 [?]
 
0
 

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!

Member Avatar
ryan_vietnow
Posting Pro
578 posts since Aug 2007
Reputation Points: 13 [?]
Q&As Helped to Solve: 74 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
debasisdas
Posting Genius
6,542 posts since Feb 2007
Reputation Points: 580 [?]
Q&As Helped to Solve: 476 [?]
Skill Endorsements: 25 [?]
Featured
 
0
 

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

Member Avatar
Jx_Man
Senior Poster
3,543 posts since Nov 2007
Reputation Points: 987 [?]
Q&As Helped to Solve: 542 [?]
Skill Endorsements: 74 [?]
Featured
 
0
 

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.

Question Answered as of 6 Years Ago by Jx_Man, cometburn, debasisdas and 1 other
Member Avatar
lenn13
Newbie Poster
2 posts since Aug 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

naim_sm
Newbie Poster
1 post since Sep 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
0
 

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

MuzAfar Bashir
Newbie Poster
1 post since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
0
 

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.

Member Avatar
shivu2303
Newbie Poster
1 post since Jul 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Can anyone explain me how to use the modules?

Member Avatar
rishif2
Posting Whiz in Training
284 posts since Dec 2012
Reputation Points: 57 [?]
Q&As Helped to Solve: 58 [?]
Skill Endorsements: 4 [?]
 
0
 

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

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article