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 - Local Scope

Although the scope of a variable depends on where it is declared in the source code, watches are all created using the same Add Watch dialog box, and edited using the same Edit Watch dialog box. The key to differentiating among the various levels of scope lies in the controls contained in the Context group of the Watch dialog boxes.

The Context group contains three controls: Procedure, Module, and Project. The control pertaining to Project is a simple label that displays the name of the current project. Because it is a label, it can’t be edited. It serves as a reminder that only those procedures and modules will be displayed by the other controls in the group.

The real work of determining the scope of a watch is done by the other two controls. If you want to define a watch at the procedure level, that means that you only want to assess the value of the Watch expression in the context of a particular procedure. To do this, use the Module combo box to select the appropriate module. The Module combo box displays the names of all modules contained in the current project.

After a module name is selected, use the Procedure combo box to choose the procedure for which the watch should be active. The Procedure combo box displays only those procedures contained in the currently selected module. If the procedure you want isn’t in the list, check the Module combo box again. You probably selected the wrong module by mistake.

Figure 18.24 shows how to use the Add Watch dialog box to create a procedure-level watch.

A procedure-level watch.
FIGURE 18.24 A procedure-level watch.

Remember that if you need to modify the settings for a watch, you can use the Edit Watch dialog box to do so. The following section shows you an example of this.


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved