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

5 answers

Hello

Module:

In general, where you can write the functions to improve the functionality of your project, which can be accessed globally in your project. To this, you do not have to make a reference of that module, just calling the Function name, will works.

Modules are basically used for declaring global variables, global functions, global user-defined variables and so on...

In VB, you can use "IsNumeric" function (so many different others) just like that, pass the parameter and get the answer.


Class Module:

Here this is bit different, as it says "Class Module", which indicates that set of functionality are categorized for specific process, so before using the functionality you have to declare that Class, and with the "dot" operator with that class, it will shows all public members and properties to use with.

So When you are declaring the Class, it allocates the memory space in the RAM for its usage and you have to dispose it with your code, when no longer needed.

In VB, if you want to use a recordset, we can't do it as we do for "Module", We have to write "dim rst as new recordset". This is the way of using class. And "rst.open" is the method for opening the recordset.

We can write these types of code in "Module" also, but it is not well organized ans structure. And it is not proper way to do.

The main thing is, they came to make our work well structured and organized and optimization on the application, Modules and Class Modules do not have any code difference in VB, in both the cases we all write normal VB code as needed. But the "way" we write the code is different. Using proper things, will improves the application overall performance.

Finally, to put it all together, its a methodology for making your work more sensible and meaningful. So each and every thing has its own purpose to use for.

Well, This is just an little bit of overlay. I have lot to say on the matter.

Hope this helps and gives you an idea.

2007-01-10 21:02:40 · answer #1 · answered by Raghavendra Mudugal 3 · 0 0

Module
the function variables defined in module , can be accessed any where in project, without any hassle, or worrying abt creating the object.

Class Module
class module comes where u want to reuse code, like u would make an employee class which have all the function related to employee e.g adding employee, seeing information related to employe, and u can use the same class in some other project.

there is a very little difference, practiclly in vb6 module can do ur most of the work, only difference is u will have to create an object of class to gain access to its members

2007-01-10 21:39:35 · answer #2 · answered by Tahir Rameez 1 · 0 0

Class Module In Vb

2016-12-18 05:40:08 · answer #3 · answered by Anonymous · 0 0

A module contains things like a record definition e.g. for use with a direct (random) access file. The record definition will be available from any form.

A class module goes further along the route of encapsulating data and the programs that manipulate it.

2007-01-10 21:01:23 · answer #4 · answered by Older&Wiser 5 · 0 0

For the best answers, search on this site https://shorturl.im/aw645

If you want to make function or method, use module. your function will can be use in all form in your project. If you want to make object, use class module. But its harder to learn how to make object then learn how to make function.

2016-04-05 23:30:35 · answer #5 · answered by Anonymous · 0 0

fedest.com, questions and answers