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()
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()
Private Sub cmdExit_Click()
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.
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
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.