The Watch Window

You can use the Watch window to evaluate variables and expressions and view the results, and also to edit the value of a variable. Figure 12-19 shows a Watch window.

nsn--

n\

hw

"

tJntrVoi

5

Irfieoei

t

lifiegti

Tni

SiiFig

5

Irfegp

i^W^l Ii

Figure 12-19: The Watch window

Figure 12-19: The Watch window

If the debugger is running or your program is in break mode, you may display the Watch window with the menu command Debug | Windows | Watch, and then click Watch1, Watch2, Watch3, or Watch4. However, the debugger must be in break mode to view or modify information in the Watch window.

You use the Name column of the Watch window to evaluate a variable or exp ression by either:

■ Double-clicking an empty row, typing or pasting the variable or expression in the Name column of the selected row, and pressing ENTER

■ Dragging variable names and expressions from the code, the Locals window, or the Autos window to the Name column of an empty row

The result appears in the Value column. Figure 12-19 shows several variables and expressions already in the Watch window. If you type the name of an array or object variable, a tree control appears next to the name in the Name column. You then would click the plus (+) or minus (-) in the Name column to expand or collapse the variable. Note An expression remains in the Watch window until you remove it.

You use the Value column of the Watch window to edit a value. Double-click the Value column in the row corresponding to the variable or expression whose value you want to change. If you typed the name of an array or object variable in the Expression box, a tree control appears next to the name in the Current value box. Click the plus (+) or minus (-) in the Name column to expand or collapse the variable to find the element whose value you want to edit. Use the mouse and keyboard to edit the value, and press ENTER.

Was this article helpful?

0 0

Post a comment