Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

Chapter 8 Debugging Visual Basic Programs 225


Remove a breakpoint


  1. In the Code Editor, click the red circle associated with the breakpoint in the Margin
    Indicator bar.
    The breakpoint disappears. That’s all there is to it! But note that if you have more
    than one breakpoint in a program, you can remove them all by clicking the Delete All
    Breakpoints command on the Debug menu. Visual Studio saves breakpoints with your
    project, so it’s important to know how to remove them; otherwise, they’ll still be in
    your program, even if you close Visual Studio and restart it!

  2. Click the Stop Debugging button on the Standard toolbar.


The Debug Test program ends.


  1. On the View menu, point to Toolbars, and then click Debug.


The Debug toolbar closes.
You’ve learned the fundamental techniques of debugging Visual Basic programs with Visual
Studio. Place a bookmark in this chapter so that you can return to it as you encounter
problems later in the book. In the next chapter, you’ll learn how to handle run-time errors by
using structured error handling techniques.

Chapter 8 Quick Reference


To Do This
Display the Debug toolbar On the View menu, point to Toolbars, and then click Debug.
Set a breakpoint In the Code Editor, click in the Margin Indicator bar next to the
statement where you want to stop program execution. When the
compiler reaches the breakpoint, it will enter debugging mode.
or
Place a Stop statement in the program code where you want to
enter debugging mode.
Execute one line of code
in the Code Editor

Click the Step Into button on the Standard toolbar.

Examine a variable,
a property, or an expression
in the Code Editor

In debugging mode, select the value in the Code Editor, and then
hold the pointer over it.

Use the Autos window to
examine a variable on the
current or previous line

In debugging mode, click the Debug menu, point to Windows, and
then click Autos.

Add a variable, a property,
or an expression to a Watch
window

In debugging mode, select the value in the Code Editor, right-click
the value, and then click Add Watch.
Free download pdf