Using the Debug Toolbar

Visual Basic provides several buttons on the Debug toolbar that are very helpful.

The following table briefly describes each button's purpose.

Command Button Description
Go Starts the debugger.
Toggle Breakpoint Toggle a breakpoint on or off on the line of code where the cursor is located.
Step Into Execute the current statement and break at the next line, even if it's in another procedure.
Step Over Execute the entire procedure called by the current line and break at the line following the current line.
Step Out Execute the remainder of the current procedure and break at the statement following the one that called the procedure.
Run to Cursor Select a statement further down in your code where you want execution to stop.

Step Into

The Step Into button executes one statement at a time at the current execution point. (This is also known as single stepping.) After stepping through each statement, you can see its effect by looking at your application's forms or the debugging windows.If the statement is a call to a procedure, the next statement displayed is the first statement in the procedure.

If there is no current execution point, the Step Into command may appear to do nothing until you do something that triggers code.

    To step through code one statement at a time

  1. On the Debug menu, choose Step Into.
  2. On the Debug toolbar, click the Step Into button.

    – Or –

Step Over

The Step Over button is similar to the Step Into button, except that when the current statement contains a call to a procedure, it executes the procedure as a unit, and then steps to the next statement in the current procedure. Therefore, the next statement displayed is the next statement in the current procedure.

    To step over code

  1. On the Debug menu, choose Step Over.
  2. On the Debug toolbar, click the Step Over button.

    – Or –

Step Out

The Step Out button causes the debugger to execute the remaining lines of a procedure. The next statement displayed is the statement following the procedure call.

    To step out of code

  1. On the Debug menu, choose Step Out.
  2. On the Debug toolbar, click the Step Out button.

    – Or –

Run to Cursor

The Run to Cursor button is used to bypass steps in the code. You can select a statement further down the code by selecting a place where you want the execution to stop.

    To bypass steps in the code

  1. Put your application in break mode.
  2. Place the cursor where you want to stop.
  3. Press CTRL+F7.

    – Or –

Exit

Stops and closes the Debugger. The Debugger cannot be restarted until the program is stopped and restarted.