A watch is a variable or expression that has been placed in the window to enable you to monitor its value.
Lets you watch the values of variables and expressions as your code executes.
When your application enters break mode, the watch expressions you select appear in a window allowing you to observe their values etc. It is also possible to set up conditional watches.
This window is automatically updated after each line of code is executed.
Although it is labelled as Watch Window the actual window displays Watches Window.
Expression - Lists the watch expression with the Watch icon, on the left.
Value - List the value of the expression at the time of the transition to break mode.
Type - Lists the expression type.
Context - Lists the context of the watch expression.
You can close the window by clicking the Close box. If the Close box is not visible, double-click the Title bar to make the Close box visible, then click it.
This window shows all the watches that have been created.
Lets you pause the program when a variable value changes.
Appears automatically when watch expressions are defined in the project.
You can change the size of the column headers by dragging its border to the right to make it larger or to the left to make it smaller.
Close the window by clicking the Close box. If the Close box is not visible, double-click the Title bar to make the Close box visible, then click it.
You can edit a value and then press ENTER, the UP ARROW key, the DOWN ARROW key, TAB, SHIFT+TAB, or click somewhere on the screen to validate the change. If the value is illegal, the Edit field remains active and the value is highlighted. A message box describing the error also appears. Cancel a change by pressing ESC.
If the context of the expression isn't in scope when going to break mode, the current value isn't displayed.
Add A Watch
3 different types of watches
highlight a variable and drag it straight in
To add a watch select (Debug > Add Watch).
Context - After adding a watch you can use these drop-downs to change the scope to "Full scope" if originally entered as local scope.
Watch Expression - Adds the expression so the value can be watched during execution. Same as Local Window.
Break When Value is True - Adds the expression so the value can be watched and execution will enter break mode if the value of the expression is true
Break When Value Changes - Add the expression so the value can be watched and execution will enter break mode if the value of the expression changes
Drag and Drop
Variables can be added by dragging and dropping them into the window. It is easy to watch individual variables.
Drag a selected variable to the Immediate window or the Watch window.
This is a feature you can use to check the value of a variable or expression quickly while in break mode.
Place the insertion point over the variable name and select (Debug > Quick Watch) or alternatively press (Shift + F9).
You can highlight complete expressions
Another way to get values for expressions and variables quickly is to enable the Auto Data Tips from the (Tools > Options)(Editor tab).
With this feature enabled when you place the mouse over a variable or select an expression and place the mouse over the expression a tool tip will appear after a sort delay displaying the current value.
To view the value of variables during execution or break mode hover the cursor over the variable within the procedure or expression. Entire expressions can be evaluated by highlighting the expression with the cursor and hovering.
Remove a Watch
Screen shots of how to remove watches (especially break when value is true)
3 different icons in window
Delete it by clicking on the far left and pressing delete
The Watch Window does not show more than 256 class objects in a collection !!!
Create a simple class and have code to test this.
© 2018 Better Solutions Limited. All Rights Reserved. © 2018 Better Solutions Limited TopPrevNext