The Debugger’s Watch window lets you monitor expression execution and results. You can even use it to temporarily change and retest variables. It can help you detect such problems as the assignment of incorrect values to variables, or assignment of values at the wrong points.

Watchpoints are evaluated and their current values displayed in the Watch window whenever program execution is paused.

Adding watchpoints

To add a watchpoint, do one of the following:

Choose Debug|Add Watch from the Debugger menu.

Right-click the Watch window and choose either Add Watch or Watch Variable At Cursor from the popup menu.

Press Ctrl+W.

The selected expression appears in the Watch window.

Note

If you haven’t already run the program past a point where variables, fields, arrays, or objects in the selected expression are initialized, "unknown" is displayed to the right of the expression.

Editing watchpoints

To edit an existing watchpoint,

  1. Select the watchpoint in the Watch window.

Changing watchpoint values

In addition to watching expressions, you can temporarily change the value of a variable. If, for example, a variable is receiving a correct value, but at the wrong point, you could

Add a watchpoint for the variable.

Pause program execution by setting up a breakpoint at the line where the correct value is supposed to be assigned to the variable.

Use the Watch window to directly assign the correct value to the variable.

It’s important to remember that this sort of testing does not result in a permanent code change. It is only intended to let you examine how your program behaves when the correct variable value is assigned. If the test is successful, you can open the dBASE Plus Source editor to permanently correct the part of the program that was responsible for returning the wrong value.