Morten,
If I have variables I want to be exposed to all classes (regular
classes, forms etc), I'd find it natural to put these in a module and
dimension them Public.
Or is the proper way to do it differently?
I would not do that. Every object is destructed every time that a procedure
goes out of scope in which it is constructed.
That procedure can be on every level. Even inside an if statement. By
keeping it as far much as possible at the procedure you have the nicest
memorymanagement, while it is as well very describtive when somebody else
is reading your programs back. (Nothing more worse than a value that is
globaly created on a whatever place).
Most what you use in your program are objects. I see seldom a reason to have
something global. (Try more and more as well to avoid shared classes. Try to
instance almost everything).
See by instance this sample.
You have somewhre created a dataset and binded that to a datagrid. That
datagrid using the designer is globaly on your form.
Therefore the reference to your dataset is.
dim ds as DataSet = directcast(mydatagrid.datasource,DataSet)
You can now use the dataset as if it was globaly created.
I hope that this gives some ideas
Cor