Understanding Scope


Scope is a term used to describe when and where a variable or procedure is available. There are three levels of scope:

Procedure.       Variables declared at this level (using the Dim keyword) are only available within the procedure. Also referred to as local .

Module.      Variables and procedures declared at this level (using the Dim keyword or ”for improved readability ”the Private keyword) are available anywhere within a form, class, or module. Also referred to as private .

Note  

Declaring a variable with module-level scope should not be confused with the idea of simply declaring a variable in a module. By default, variables declared in a module are available only within the module (module scope), but declaring a variable with the Public keyword makes it available everywhere (global scope).

Global.      Variables and procedures declared at this level (using the Public keyword) are available throughout your program. Also referred to as public .

The value stored in any variable is temporary, dependent upon where it was declared. When a variable goes out of scope it is reset to its default value, such as 0 for numeric variables. In the case of a local variable, for example, it goes out of scope when the procedure in which it is declared has been completed.




Microsoft Office Project 2003 Inside Out
Microsoft Office Project 2003 Inside Out
ISBN: 0735619581
EAN: 2147483647
Year: 2003
Pages: 268

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net