What is the difference between module and forms in vb?

jaisonshereen
jaisonshereen used Ask the Experts™
on
What is the difference between module and forms in vb?

when i open both in i can see the code !!

can u explain?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Applications Developer / Integrator
Commented:
A form is the graphical interface that the user will interact with. It can and usually does contain code specific to the controls that exist on the form. These might be buttons, listboxes, etc.

A module in vb is used to encapsulate code. At its purest form a module would contain code used for specific tasks and a new module would be used for other specific tasks.

In the past, I have created modules that contain utility routines that I find I use frequently. I can then include the module of my utility routines into any new project I have and reuse that code.

Code or functions/subs in a VB form can be addressed using the Me prefix. A module does not exist within a form, so that context is not available.

Hope this helps.

Dan

Author

Commented:
well thanks,

So a module is part of the entire application where forms resides right?

Daniel ReynoldsSoftware Applications Developer / Integrator

Commented:
Yes, A module would be a part of the application.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial