Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Class Modules & User Controls 1

Status
Not open for further replies.

Rougy

Programmer
Oct 15, 2001
249
US
Hi,

I've been programming in VB6 for about a year and a half now, and I've come to the point where I think there's a better way of doing things but I'm not sure how to go about doing it.

I'm curious about class modules and user controls in particular.

Included with the VB6 package are example programs that use class modules and user controls, but for the life of me I can't see what the advantage is.

If anybody has the time and knowledge, would you mind telling me a little more about the relevant pros and cons regarding these items.

Thanks

-----
The death of dogma is the birth of reason.
 

Hi Rougy:

You have opened the proverbial "can of worms" in that various programmers will cite different benefits to class modules and user controls.

The biggest advantage that I see in using class modules is encapsulating of various data and the code for that data into one location. When one works with the data, one can impose rules on the data (such as ranges for numbers) without having to constantly adding code through the main program to handle the coding, nor having to write a sub in the main program just to do rule enforcement. If one needs to check the code that handles a particular piece of data, then the code is one location, not spread throughout the program.

AS for user controls, it is nice to build a user control, "work it up" and get it fully debugged. Then, just like adding a listbox, command button, or other control, your custom control is just as easy to use. With each program that you need the specific functionality of the custom control, you just drop the control in and tailor it through its property page(s) -- just like VB's built-in controls, which are the same type of controls (OCX).

Cassie
 
Thanks Cassie.

-----
The death of dogma is the birth of reason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top