Preview
In this first class, we will do a quick overview of how to build an application in Visual Basic. You’ll learn a new vocabulary, a new approach to programming, and ways to move around in the Visual Basic environment. You will leave having written your first Visual Basic program.
Course Objectives
- Understand the benefits of using Microsoft Visual Basic 6.0 for Windows
as an application tool - Understand the Visual Basic event-driven programming concepts,
terminology, and available tools - Learn the fundamentals of designing, implementing, and distributing a
Visual Basic application - Learn to use the Visual Basic toolbox
- Learn to modify object properties
- Learn object methods
- Use the menu design window
- Understand proper debugging and error-handling procedures
- Gain a basic understanding of database access and management using
databound controls
What is Visual Basic?
- Visual Basic is a tool that allows you to develop Windows (Graphic User Interface - GUI) applications. The applications have a familiar appearance to the user.
- Visual Basic is event-driven, meaning code remains idle until called upon to respond to some event (button pressing, menu selection, ...). Visual Basic is governed by an event processor. Nothing happens until an event is detected. Once an event is detected, the code corresponding to that event (event procedure) is executed. Program control is then returned to the event processor.
Some Features of Visual Basic
- Full set of objects - you 'draw' the application
- Lots of icons and pictures for your use
- Response to mouse and keyboard actions
- Clipboard and printer access
- Full array of mathematical, string handling, and graphics functions
- Can handle fixed and dynamic variable and control arrays
- Sequential and random access file support
- Useful debugger and error-handling facilities
- Powerful database access tools
- ActiveX support
- Package & Deployment Wizard makes distributing your applications simple
Visual Basic 6.0 versus Other Versions of Visual Basic
- The original Visual Basic for DOS and Visual Basic For Windows were introduced in 1991.
- Visual Basic 3.0 (a vast improvement over previous versions) was released in 1993.
- Visual Basic 4.0 released in late 1995 (added 32 bit application support).
- Visual Basic 5.0 released in late 1996. New environment, supported creation of ActiveX controls, deleted 16 bit application support.
- And, now Visual Basic 6.0 - some identified new features of Visual Basic 6.0:
- Faster compiler
- New ActiveX data control object
- Allows database integration with wide variety of applications
- New data report designer
- New Package & Deployment Wizard
- Additional internet capabilities
Application (Project) is made up of:
- Forms - Windows that you create for user interface
- Controls - Graphical features drawn on forms to allow user interaction (text boxes, labels, scroll bars, command buttons, etc.) (Forms and Controls are objects.)
- Properties - Every characteristic of a form or control is specified by a property. Example properties include names, captions, size, color, position, and contents. Visual Basic applies default properties. You can change properties at design time or run time.
- Methods - Built-in procedure that can be invoked to impart some action to a particular object.
- Event Procedures - Code related to some object. This is the code that is executed when a certain event occurs.
- General Procedures - Code not related to objects. This code must be invoked by the application.
- Modules - Collection of general procedures, variable declarations, and constant definitions used by application.
Steps in Developing Application
There are three primary steps involved in building a Visual Basic application:
- Draw the user interface
- Assign properties to controls
- Attach code to controls
Object Naming Conventions
This table lists the naming conventions for objects created by the 20 standard Visual Basic toolbox controls. (Form and menu objects, which you use often but which are not in the toolbox, are given the prefixes frm and mnu respectively.) Whenever you use more than five or six objects on a form, use this table as a naming guide:
Source: EASTERN
MEDITERRANEAN UNIVERSITY - MECHANICAL ENGINEERING DEPARTMENT