Table of contents
TOC
Collapse the table of content
Expand the table of content

Add a Watch Expression

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

A watch expression is an expression you define to be monitored in the Watch window. When your application entersbreak mode, the watch expressions you selected appear in the Watch window where you can observe their values.

To add a watch expression

  1. On the Debug menu, click Add Watch. The Add Watch dialog box is displayed.

  2. If an expression is already selected in the Code window, it is automatically displayed in the Expression box. If no expression is displayed, enter the expression you want to evaluate. The expression can be avariable, a property, a function call, or any other valid expression.

  3. Select a module orprocedure context in the Context group to select the range for which the expression will be evaluated.

    Note Select the narrowest scope that fits your needs. Selecting all procedures or all modules can slow down module execution considerably, since the expression is evaluated after execution of each statement. If you select a specific procedure for a context, execution is affected only while the procedure is in the list of active procedure calls. Choose Call Stack from the View menu to display the list of active procedures.

  4. Select an option in the Watch Type group to define how the system responds to the watch expression.
  - To display the value of the watch expression, click  **Watch Expression**.
  • To stop execution if the expression evaluates to True, click Break When Value is True.

  • To stop execution when the value of the expression changes, click Break When Value Changes.

  1. Click OK.
© 2018 Microsoft