Lucy wrote:
Thanks for the quick response!
Ok, I see the difference between Public and the other two. What is the
difference between Dim Flag and Private Flag? Is there a time when to use
one and not the other?
(for short answer, skip to last para)
Back in the "good old days" Dim was used to "dimension" an array, it
still is but back then it was the only thing it was used for on BASIC,
other intrinsic variables were not declared at all.
With the advent of QuickBASIC (in the MS stable at least) we started
seeing the of "Dim" to declare variables, since "Dim" is short for
"Dimension" and intrinsic variables don't have dimensions (arrays do)
this was a pretty silly thing to use, but use it they did.
A lack of planning and/or slap happy ad-hoc development lead us down the
road of having global or shared variables in BASIC by using "Dim Shared"
in the module level to share a variable with all subs and functions,
"Shared" as a declaration in a sub/function to share it with the module
level code (entry point was at module level, no sub main back then) and
"common" to share across multiple modules although that declaration had
to exist in all modules that would see that variable. To have it in all
modules the use of an include file was quite slick.
The use of "Shared" seemed to disappear about the time of VB, probably
because of the way VB now used Sub Main or a form event as the entry
point to the program rather than the old fasioned way of module level
code and the use of "Dim" at the module level replaced "Dim Shared" and
"Global" replaced and enhanced "Common" as only one declaration was
required. (b4, "Dim" at the module level would make the variable
available to module level code only, not the subs and functions)
Later versions of VB started using "Private" and "Public" to distinguish
between module wide and global variables, this makes the module wide
declaration more explicit than "Dim", which apart from it's original use
to dimension an array, is there for backward compatability for intrinsic
variables.
--
\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\