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 

Introduction

This course is a brief introduction to using Visual Basic. It was originally written for Version 3, (VB3), however, much of the course equally applies to latter versions. Where differences occur I shall endeavour to make these apparent, if I miss anything or if there appears to be a confusion, please let me know or visit the bulletin board. There are also many similarities between VB3, Visual Basic for Applications (VBA) and Access Basic (as used in Access 1.0,1.1 & 2.0.) If you want to grasp the basics of using VB, I would recommend obtaining VB3 as it can now be found for as little as £4, ($6 US) at computer fairs / auctions. Alternatively the VB6 Working modal edition is available bundled free with 

The VB3 development environment strongly resembles the Access 2.0 form design environment and so many of the features may seem familiar. The Edition of VB3 which we will be using is the Professional Edition. This differs from the standard edition in that it contains a number of enhancements, including the provision of database management features.

The aims of this course are to provide a background and basic grounding in the use of VB as a applications development tool. It is intended for this knowledge to be used as a pre-requisite to Visual Basic Version 5/6 programming training in advanced features such as connecting to remote data objects.

At the end of this course you should be able to :-

This course is presented in a series of 1 day events, it should last 15 days. A copy of the whole course, (latest edition) is available on request.

Conventions

Throughout the code used in VB3 a dot notation is used to convey operations on an object, whether that is an attribute of the object, a method operating on the object or to show that an object is contained by another object. This becomes clearer with use but does not exactly equate to the dot notation used by other programming languages.

Code has been indented for clarity.

Starting VB3

Start VB3 by double clicking on the icon shown below (in the visual basic 3.0 folder);

this opens up the Visual Basic 3 development environment.

The development environment

The development environment initially consists of a number of windows,

all commands may be accessed through the main menu; some of the windows may initially overlap , (in this example not all the properties window is visible) but these may all be re-sized or minimized as needed. The features shown consist of a toolbox window containing all the supplied components that can be used on a form, the project window that displays all the components within the current (default) project, a properties window that displays the properties of the selected component (initially this is the properties of Form1, the default form) and Form1, the default form for the default project. Applications built using VB3 are form based, any components used within the application are placed upon a form. Code can be written which can modify components properties by responding to events. Just below the Main Menu there is a tool bar. This has particular significance when running, testing and saving applications. We will examine development environment in greater detail by building a series of simple applications.

Help Documentation

VB3 comes complete with on-line help documentation and a Tutorial. The help documentation carries many examples of the use of code solutions. These can all be copied into your code windows where they can be modified to suit your application.

The On-line Tutorial

Can be accessed at any time by choosing the Learning Microsoft Visual Basic option from the Help menu, however, if you are currently working on a project you will be prompted to save it first. The tutorial is written using VB3 !, it covers most aspects of using VB3 and is useful as a reference to this course.

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