VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering

You are here: Visual Basic > Advanced VB6 tutorial > Chapter 18

Chapter 18 - Using VB’s Debug/Watch Facilities

( Contents )

The Debug window and the associated Debug object are VB’s main built-in features for debugging your code at design time.

Bugs are a fact of life. Even the most finely honed programming discipline can’t guarantee error-free code. Because you can’t absolutely prevent bugs from being written in the first place, you have to settle for second best by trying to stamp them out before they inadvertently get released into a product.

Fortunately, VB gives you a lot of opportunities to find your bugs before you put your software into the hands of your users. The primary debugging tools in the Visual Basic programming environment are the following three debugging windows:

  • The Watch window
  • The Immediate window
  • The Locals window

This chapter covers the following topics:

  • Bug prevention
  • Watch expressions, types, and contexts
  • Break mode
  • The Immediate window and the Debug object
  • Interacting with the Immediate window
  • Locals
  • When to use the Immediate window in place of breakpoints
  • Levels of scope
  • Scope considerations


  1. Preventing Bugs

  2. Using Watch Expressions and Contexts
    Creating a Watch Expression
    Types of Watch Expression
    Watch Contexts

  3. Using Break Mode
    Entering Break Mode Manually
    Stepping Through Your Code
    Using the Watch Window
    Entering Break Mode Dynamically

  4. Using Quick Watch

  5. Watching on Demand

  6. Immediate Window and the Debug Object
    Displaying the Debug Window
    Displaying Messages Programmatically With the Debug Object

  7. Using the Print Method
    Formatting Debug.Print Messages
    Displaying Data Values

  8. Using the Debug.Assert Method

  9. Interacting with the Immediate Window
    Querying or Modifying Data Values
    Testing and Executing VB Procedures

  10. Using the Locals Window

  11. Using the Immediate Window in Place of Breakpoints
    Using the MouseDown and KeyDown Events
    Using the GotFocus and LostFocus Events

  12. Levels of Scope
    Local Scope
    Module Scope
    Global Scope

  13. Scope Considerations
    Striving to Narrow the Scope
    Performance Concerns


Get Started >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved