The Debugging Tool
Visual Basic's development environment includes a debugging tool
that becomes part of the development environment when you request
debugging help. The debug tool lets you do all the following tasks:
- Analyze variable contents at runtime.
- Stop the program at any statement and restart when ready.
- Set breakpoints throughout the code that automatically
stop the program execution when a breakpoint is reached.
- Change variables during the execution of a program to different
values from their current state to test the application.
- Set watch variables that halt the program's execution
when the watch variables receive a specific value or range of
values.
- Skip statements you don't want to execute during a test.
- Use the Debug object's output window to print values during
a program's execution. The debug window lets you capture output,
such as variable values, without disturbing the normal form window.
You can enter the debugging mode and have access to all the debugger's
features (primarily found on the Debug menu) when you do
any of the following:
- Press Ctrl+Break to stop the program's execution in midstream.
- Receive a runtime error message dialog box.
- Set a breakpoint, and execution reaches that breakpoint.
- Click a statement in the program and then, from the Debug
menu, choose Run To Cursor to execute the program as usual.
Visual Basic halts the program and enters debugging mode as soon
as execution reaches the cursor.