THE CODE EDITOR AT RUN TIME

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).


ESSENTIAL SHORTCUTS
Some very handy runtime shortcuts are F5 (Start Debugging), F8 (Step Into), Shift+F8 (Step Over), and Ctrl+F9 (Set Next Statement). Some particularly handy code editing shortcuts are F9 (Toggle Breakpoint) and Shift+Space (Open IntelliSense). You might want to write down these and any others that you use frequently.
(Note that some shortcuts are different if you don’t have Visual Studio set up for Visual Basic development. If the IDE is customized for C# or general development, Step Over is F10 and Step Into is F11.)

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.


REPOSITION RESTRICTIONS
There are some restrictions on where you can move the execution position. For example, you cannot jump out of one routine and into another.

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.230.81