Using Watches

Watches are used to keep track of values automatically while debugging. A watch is anything that can be evaluated to produce a value, which means it can be an expression such as ActiveProject.Tasks(intBefore).Name = strName, or simply the name of a function or variable (see Figure 31-16).

Watches

Q

Expression

1 Value | Type

I Context

-

strTaskName

This is the value for strTaskName" String

Th isProject. AddTask

Figure 31-16. The Context column shows that the scope for the variable is local, existing in the AddTask procedure of the current module. If the active statement were in another procedure, the Value column would display <Out of context>.

Note Use Auto Data Tips as a watch

The Auto Data Tips option (enabled by default) works like an ad hoc watch by providing information about the value of a variable (including the value of properties) when you move the mouse pointer over it while in break mode.

You can use watches in two ways:

• To simply watch the value of an expression while debugging.

• To define a condition, rather than simply a line of code, that should force entry into break mode.

You can add watches while in design mode or break mode. Although you can manually enter the expression you want to watch in the Add Watch window (see Figure 31-17), it's easier to simply highlight the variable or expression by right-clicking in the Code window and then clicking Add Watch.

o t ffi

Figure 31-17. Set the Watch Type to specify whether you want to watch the expression or test its value to determine when to enter break mode.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment