Global Variables

jamesanthony

Freshman
Joined
Jun 9, 2003
Messages
25
Hi All
I have asked this before and got the grunted answer, "Thats the way it is now, get used to it".
Anyway my problem
I Cannot program without global variables
I keep a lot of information global ie.
Printer Names and locations.
User login names
Server Names
Database Names
Etc
Etc
It would mean for every form I have I must supply all this global information again. Is this correct. I thought .NET was an improvment on VB6. so far I cant see it, everything gets so complicated and long winded with tons of code.
Hardly 4th generation stuff.
Any help or suggestions appreciated.
Cheers
JR
 
Well I think that Robby was right. Create a module, initialize public variable in it. And on the first from, assign values to this varialbe, and then use them in all your form without assigning new values to them, and without declaring them. They'll take the values of the first form.
Cheers,
Mohsen
 
Whats the right way and the wrong way - really does just depend what works.

Go with declaring them globally in the module. Using classes does have its advantages - but if you not planning to use those advantages, then theres no point in overly worrying about them.

Obviously using the classes is good practice for when you may want to take advantage of there flexibility.
 
Back
Top