Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 18

Levels of Scope - Global Scope

What if you want to monitor an expression throughout your entire program? Just as you can set a single watch pertaining to an individual module, you can also set a single watch that applies to an entire program.

To define a global watch, you once again can use either the Add Watch dialog box or Edit Watch dialog box. First, select All Modules from the Module combo box. (As with the Procedure combo box, the All selection is the first item in the drop-down list.) This will also automatically set the Procedure watch to All Procedures in the Procedure combo box. Figure 18.26 shows an example of this.

A global watch.
FIGURE 18.26 A global watch.

The Watch expression in Figure 18.26 will be evaluated in all procedures in all modules as the program executes, making it global in scope.

As you set watches at various levels of scope, you will notice that the Watches dialog box displays the context of each expression. As shown in Figure 18.27, a procedure-level watch is indicated to apply to a particular procedure by the ModuleName.ProcedureName syntax in the Context column of the Watches dialog box. A module-level watch has the name of its module displayed in this column. A global watch is indicated when the entry is blank, denoting that there is no contextual limitation on the watch.

The Watches dialog box indicates the level of scope for each Watch expression.
FIGURE 18.27. The Watches dialog box indicates the level of scope for each Watch expression.


  

<< Previous | Contents | Next >>

 

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved