English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i got a problem with Visual Basic especialy module in VB, what is module..?
when we use it (module)..??
how we use it..??
i need an article about module which related with databases.
any one help ...please..

2007-03-16 14:34:29 · 3 answers · asked by jhoni d 1 in Computers & Internet Programming & Design

3 answers

A module is a place to write code which will have global scope. Meaning that any form or class can see and use any public variable,sub,function etc written in the module.

Modules provide an easy means to segregate and reuse code. You can make a module which contains physics equations for example called "modPhys" in which you place public constants for gravity, and functions for acceleration etc...

So the following placed in modPhys
Public Const g as double = 32 ' gravity

would be available to the entire program and accessed

'Code in a form for example
Dim gravity as double

gravity = modPhys.g

2007-03-16 23:05:50 · answer #1 · answered by MarkG 7 · 0 0

A module in VB is like a class file but it just contains function declaration, no variable declarations, well there can be but usually you're manipulating the variables given to the functions. A module contains functions that can be used in any part of the program that imports the module(with "imports moduleName").

The main time I use modules is to contain the functions for connecting and disconnecting to a database, loading a combo box with values, or doing some other repetitive processes.

Modules are very easy to use. They work almost like classes except the key word is, you guessed it, "module"
here's an outline of a simple module:

Module mdlDBUtilities
Public Function Connected() As OleDbConnection

End Function
Public Sub CloseDBConnection(ByVal dbconnect As
OleDbConnection)

End Function
End Module

That's a basic outline(minus the actual code) of the module I use for my basic DB functions. Sorry but I don't know of any articles that outline the use of Modules. Basically the main use is to hold functions that don't really fit into any class and it makes your main source code file cleaner.

Hope this helps,
Mike

2007-03-16 22:37:50 · answer #2 · answered by Mike 2 · 0 1

In computer science, a module is a software entity that groups a set of (typically cohesive) subprograms and data structures. Modules are units that can be compiled separately, which makes them reusable and allows multiple programmers to work on different modules simultaneously. Modules also promote modularity and encapsulation (i.e. information hiding), both of which can make complex programs easier to understand.

Modules provide a separation between interface and implementation. A module interface expresses the elements that are provided and required by the module. The elements defined in the interface are visible to other modules. The implementation contains the working code that corresponds to the elements declared in the interface. Languages that explicitly support the module concept include Ada, D, F, Fortran, Pascal (some derivatives), ML, Modula-2, Python and Ruby. The IBM System i (aka AS/400 and iSeries) also uses Modules in RPG, COBOL and CL when programming in the ILE environment.

2007-03-16 21:52:43 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers