Chris's Event Programming with Visual Basic course.

Contents
Introduction

Conventions

Starting VB3

The development environment

Help Documentation

The "On-line" Tutorial

Starting a new project

Making an application

Working with Forms

Modal forms

Multiple Document Interface (MDI)

Building the interface

Menus 

Tool Bars & Control Arrays

Building a Control Array

Z Order

Custom controls

Handling Data

Input Boxes

Message Boxes

Error Trapping

The Data Manager

Data Aware Components

Debugging code

Compilation of code 


 
 
 
 

Debugging code

There are three types of errors you may encounter as you run your application:

Compile errors occur as a result of code that is incorrectly constructed. You may have an incorrectly matched control structure, such as a Next statement without a corresponding For statement, or programming mistakes that violate the rules of Basic, such as a misspelled word, a missing separator, or a type mismatch. Compile errors include syntax errors, which are errors in the grammar or punctuation recognised by Visual Basic. Examples of syntax errors include passing an incorrect number of arguments to an intrinsic function or forgetting to match parentheses.

Run-time errors occur after the application starts to execute. Examples of run-time errors include attempting an illegal operation, such as writing to a file that doesn't exist, or dividing by zero.

Logical errors where the program doesn't perform as intended, and produces incorrect results.

Debugging is a process by which you find and resolve errors in your code. To debug code in Visual Basic, consider the ideas suggested below. These techniques can also be applied in different sequences.

  1. Print the code, if you find it easier to read code on paper instead of online.

2. Run the application to find trouble spots:

3. Use debugging tools and techniques to isolate bugs and to monitor code flow:

4. Try out bug fixes and then make edits:


 
 
 
 
 
 
 

Visual Basic and all other Microsoft products mentioned in this series are trademarks of the Microsoft Corporation.