|
Debugging Visual Basic programs
ENGR
2200 - Numerical Methods in Engineering I (Fall 2001) and Graduate-Level VB/VBA
Course (Spring 2002)
Gilberto
E. Urroz - ph. 435-797-3379 - gurro@cc.usu.edu
- EC 214 - fax 435-797-1185
Appendix D in the Visual
Basic textbook (Schneider) (pp. 719-728) provides information on the use of
the Visual Basic Debugging Tools. Examples for debugging are available for
download in the Visual Basic
exercise page.
Debugging instructions also included in Chapter
6 of Gottfried's book.
Some commands/concepts for debugging
-
Select option Step Into in menu Debug to
start the debugger
-
[ F8 ] = Step into: let's you move step-by-step
through a program.
-
Arrow and yellow highlight indicate which command is
waiting execution.
-
[Shift][ F8 ] = Step over: continues normal
program execution.
-
Place cursor over a variable to see current value of that
variable.
-
The immediate window (shows up at the bottom of the
code window when debugging) lets you perform Basic commands without
interfering with the VB program.
-
The Add Watch option in the Debug menu lets
you define variable names to watch as the program is debugged.
-
The Edit Watch option in the Debug menu lets
you modify or delete variable names under watch.
-
Breakpoints are points where debugging will be
triggered within your program.
-
To set a breakpoint click on the left margin of the code
window at the level of the command line that you want to set as the
breakpoint. A red circle will show up in the left margin of the window
and the command will be highlighted in red.
-
To remove a breakpoint click on the breakpoint
line. The red circle and highlight will disappear.
|