• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

VB6 Global Variables being used in classes and forms

I am creating an N-Tier Application in VB6. I have several forms, a module and 10 classes. Each class instantiates a dataaccess class that connects to my Database.

In my module, I have several global variables declared that I use in my classes and forms. Is it OK to use the globes in the classes and the forms, or should I declare the global variables in my form, use them only in the forms, and pass the info in the global’s through my LETS AND GETS that are in the classes?

My code is compiled into a installation package after I create a DLL from the classes and module.
0
AmericaFan
Asked:
AmericaFan
1 Solution
 
quiklearnerCommented:
You can use the globals everywhere.  Whether you want to paas stuff through gets and lets depends on if you forsee re-using any of the classes/forms elsewhere,  where you would want to encapsulate the process of setting those values in the form/class itself.  Globals declared in modules will work just fine though.  As long as everything is pretty much built for this application and tied together well, globals will actually work faster as memory doesn't need to be allocated to hold duplicate values, improving both memory and processor usage (slight processor usage improvment related to extra memory allocation and value setting)
0
 
AmericaFanAuthor Commented:
Thanks you. That clears up a lot of things that have been bugging me about 3 tier development.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now