Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Adding Watches
◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Adding Watches
■ Visual Basic provides three different kinds of watches:
• Watch variables are used to continuously watch the value of a variable
or an expression as your project executes
• Watchpoints are used to suspend project execution when an expression
becomes true
• Instant watches display current value of a variable or an expression
when project execution is suspended
■ To add a watch variable:
1. Choose Add Watch from the Debug menu in the programming environment
2. Type the variable name or expression you want to watch
The Debug window can display the value of an expression made of
variables (for example, X + Y).
3. Press Enter or choose OK to add the watch variable
After you choose OK, the variable name is displayed in the Debug
window, preceded by the procedure name or module file name where
the variable is located. The message <Not watchable> appears in
the Debug window if Visual Basic cannot access the variable value.
■ To enter a watchpoint:
1. Choose Watchpoint from the Debug menu
2. Type in a variable name or expression
A relational statement is constructed using these operators:
= Equal < Less than
<> Not equal >= Greater than or equal to
> Greater than <= Less than or equal to
If you enter only a variable name or expression, Visual Basic assumes
the relation "<> 0." For example, entering X + Y yields this
expression:
X + Y <> 0
3. Press Enter or choose OK
■ To display the current value of a variable or expression:
1. Place the cursor on the variable name or selected expression
2. Invoke the Instant Watch dialog
This is done by either choosing Instant Watch from the Debug menu,
pressing Shift+F9, or pressing Shift and clicking the right mouse
button simultaneously.
• The expression is True if Instant Watch displays a nonzero value,
False if it displays 0. The message <Not watchable> appears in the
Value box if Visual Basic cannot access the value of the variable.
See: ◄Removing Watches►