Datasheet

Figure 1-35: The When Breakpoint Is Hit Condition dialog
lets you determine what actions Visual Basic takes when
the breakpoint is activated.
The Command and Immediate Windows
The Command and Immediate windows both allow you to execute commands while the program is
stopped in the debugger. One of the more useful commands in each of these windows is the
Debug.Print
statement. For example, the command Debug.Print x displays the value of the variable x.
You can use a question mark as an abbreviation for
Debug.Print. The following text shows how the
command might appear in the Command window. Here the
> symbol is the command prompt provided
by the window and
123 is the result: the value of variable x. In the Immediate window, the statement
would not include the “>” character.
>? x
123
The command >immed tells the Command window to open the Immediate window. Conversely, the
command
>cmd tells the Immediate window to open the Command window.
While there is some overlap between these two windows, they serve two mostly different purposes. The
Command window can issue commands to the Visual Studio IDE. Typically, these are commands that
appear in menus or toolbars, or that could appear in menus and toolbars. For example, the following
command uses the Debug menu’s QuickWatch command to open a QuickWatch window for the vari-
able
first_name.
>Debug.QuickWatch first_name
32
Chapter 1
571982 ch01_2.qxd 1/19/06 1:15 PM Page 32