The program can be executed one statement at a time, with each press of an appropriate function key executing a statement. This process is called stepping. After each step, values of variables, expressions, and conditions can be displayed in the debugging windows, and the values of variables can be changed. When a procedure is called, the lines of the procedure can be executed one at a time, referred to as stepping into the procedure, or the entire procedure can be executed at once, referred to as stepping over a procedure. A step over a procedure is called a procedure step. In addition, you can execute the remainder of the current procedure at once, referred to as stepping out of the procedure. The three toolbar buttons shown in Figure D.1 can be used for stepping. Figure D.1. The toolbar buttons used to Step Into, Step Over, and Step Out.
As another debugging tool, Visual Basic allows the programmer to specify certain lines as breakpoints. Then, when the program is run, execution will stop at the first breakpoint reached. The programmer can then either step through the program or continue execution to the next breakpoint. Also, the programmer can place the cursor on any line in the program and have execution stop at that line with a "Run to Cursor" command. Program execution normally proceeds in order through the statements in the procedure. However, at any time the programmer can specify the next statement to be executed. The tasks discussed previously are summarized next, along with a means to carry out each task. The tasks invoked with function keys also can be produced from the menu bar, the context menu (produced by clicking the right mouse button), or the toolbar.
|