4.9.4 Using the Quick Watch Command

Using the Quick Watch command is a convenient way to take a quick look at a variable or expression. Because the Quick Watch dialog box can display only one variable at a time, it's best to use the Watch window to view most variables.

Selecting the Quick Watch command from the Watch menu (or pressing SHIFT+F9) displays the Quick Watch dialog box. If the cursor is in the Source, Local, or Watch window, the variable at the current cursor position appears in the Quick Watch dialog box.

The Quick Watch display automatically expands arrays and structures to their first level. For example, an array with three dimensions expands to the first dimension. You can expand or contract an element just as you would in the Watch window; position the cursor on the appropriate line and press ENTER. If the array has more lines than the Quick Watch dialog box can display, you can view the rest of the array either by using the scroll bar or by pressing the DOWN ARROW or PAGE DOWN key.

To add a Quick Watch item to the Watch window, choose the Add Watch button. Arrays and structures appear in the Watch window expanded as they were displayed in the Quick Watch dialog box.

You can also display a Quick Watch dialog box for a variable by typing two question marks and the variable name in the Command window. For example, the following command shows the contents of the Index variable:

?? Index