Understanding Variable Scope and Duration in Visual Basic 6

Variable Scope

The scope of a variable determines where you can access that variable in your code. If a variable is in scope you can read or set it’s value. If it is out of scope you will not be able to access it.

There are three types of scope for variables in Visual Basic:

Global Scope
Global variables are in scope anywhere in your application. Module Scope
Module level variables are in scope anywhere within the module where they are declared. Local Scope
Local variables are only in scope within the procedure where they are declared.

Continue reading “Understanding Variable Scope and Duration in Visual Basic 6”