-
Apr 10th, 2008, 11:01 AM
#1
Using VB6 Debug - Descriptions of the Components Part 2
Quick Watch
Availability: Always available but only useful when in break mode
Shortcut: SHIFT+F9
As mentioned previously if you highlight a variable or a valid expression, clicking the Quick Watch button will show you the value. Here's an example where I've done that with txtSquare(intSquare).Text (which is a valid expression) and you can see that the value is Y. Clicking the Add button allows you to add a watch, but more about that later.
Locals Window
Availability: Always available but only useful when in break mode
Shortcut: (None)
Here's what you would see at the same point in the point in the program if you opened the Locals window. I've expanded the information for the form (Me) and the information for the Controls.Item6.
Step Into
Availability: Design time and when in break mode
Shortcut: F8
Step Into allows you follow the execution of your program line by line as VB executes it. If you press F8 at Design Time the program will start just like it would if you pressed F5 (Start), except that after it is started VB will pause the program just before the first executable line and it will highlight that first executable line in yellow. It will also place a yellow arrow in the left-hand margin. When you press F8 while in break mode VB executes the current line and then pauses at the next line. In either case you can step through the whole program if you desire by repetitively pressing F8. Note that at any time during that process you can use the Quick Watch, Immediate or Locals window as described above.
One very useful feature that is available while stepping through the code is the ability to drag the yellow arrow to any executable line of code, thus allowing you to skip or repeat lines.
Step Over
Availability: Design time and when in break mode
Shortcut: SHIFT+F8
Step Over is similar to Step Into except that as its name implies it will step over or skip the current line. Note that it doesn't skip the execution of the line, only the stepping through. In other words if the current line is a call to a long Sub that you don't really care about, stepping over will execute the call and then pause at the line following the call.
Step Out
Availability: Design time and when in break mode
Shortcut: CTRL+SHIFT+F8
If you are in the same long sub as mentioned above, pressing Step Out will leave that sub and pause at the next executable line. Just like Step Into, Step Out doesn't skip the execution of the rest of the sub, only your viewing of it.
Call Stack
Availability: In break mode
Shortcut: CTRL+L
The Call Stack displays a list of all active procedure calls. An active procedure are the Subs and Functions in the application that were started but not yet completed. In the following trivial example a breakpoint was placed on last in a string of Subs and the Call Stack shows the order of the calls (bottom up) that got us to the breakpoint. All the subs are shown in the list because none of them have actually finished yet. If you were to step through the code from this point you would see the subs, starting with Sub5, disappear one by one from the Call Stack as the code progressed back up the chain exiting and thus finishing the subs. Finally, if you double-click on one of the entries or click on it and then press the Show button you will be taken to that procedure and a green triangle will be placed in the left-hand margin showing the next procedure in the stack.
BTW, if you would like to be able to see the chain of all procedures and not just the active ones that got you to your breakpoint, you can use my Insert Procedure Names Add-In.
Last edited by MartinLiss; Apr 27th, 2008 at 11:09 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|