The code editor behaves slightly differently at run time and design time. Many of its design-time features still work. Breakpoints, bookmarks, IntelliSense, and snippets still work.
At run time, the editor adds new tools for controlling the program’s execution. Right-click a value and select Add Watch or QuickWatch to examine and monitor the value. Use the Step Into, Step Over, and Step Out commands on the Debug menu or toolbar to make the program walk through the code. Hover the mouse over a variable to see a tooltip giving the variable’s value (see the section “Tooltips” earlier in this chapter for more information).
Right-click and select Show Next Statement to move the cursor to the next statement that the program will execute. Select Run To Cursor to make the program continue running until it reaches the cursor’s current line.
Right-click and select Set Next Statement to make the program skip to a new location. You can also drag the yellow arrow indicating the next statement to a new location in the left margin.
By using all of these runtime features, you can walk through the code while it executes and learn exactly what it is doing at each step. You can see the values of variables, follow paths of execution through If-Then statements, step in and out of routines, and run until particular conditions are met.
For more information on the Debug menu and its submenus, see the section “Debug” in Chapter 2, “Menus, Toolbars, and Windows.” For more information on debugging techniques, see Chapter 6, “Debugging.”
You can discover other runtime features by exploring the editor at run time. Right-click different parts of the editor to see which commands are available in that mode.