You can use the Visual Studio Watch window while debugging to watch how the values of variables and expressions in your code change:
- To open the Watch window, click
Debug > Windows > Watch > Watch
n while debugging.
- To add variables to the Watch window, right-click a variable in the editor and click
Add Watch. Alternatively, in the Watch window, click an empty row in the
Name column, and type a variable or an expression.
- To change the display format for all values in the Watch window from decimal to hexadecimal, right-click in the Watch window, and then click
Hexadecimal Display.
- To change the format of display of the values on individual rows in the Watch window, click a row, press
F2, and type a modifier after the name of the variable or the expression as follows:
- h or x
- Type
Variable,h or
Variable,x to always display the variable or the expression in hexadecimal format.
- d
- Type
Variable,d to always display numeric variables in decimal format and strings - as text.