1. Introduction to the Visual Basic Language and Environment
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
Þ Obtain an introduction to ActiveX controls and the Windows Application Programming Interface (API)
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 capabilites
16 Bits versus 32 Bits
· Applications built using the Visual Basic 3.0 and the 16 bit version of Visual Basic 4.0 will run under Windows 3.1, Windows for Workgroups, Windows NT, or Windows 95
· Applications built using the 32 bit version of Visual Basic 4.0, Visual Basic 5.0 and Visual Basic 6.0 will only run with Windows 95 or Windows NT (Version 3.5.1 or higher).
· In this class, we will use Visual Basic 6.0 under Windows 95, recognizing such applications will not operate in 16 bit environments.
Structure of a Visual Basic Application
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:
1. Draw the user interface
2. Assign properties to controls
3. Attach code to controls
We’ll look at each step.
Drawing the User Interface and Setting Properties
· Visual Basic operates in three modes.
Þ Design mode - used to build application
Þ Run mode - used to run the application
Þ Break mode - application halted and debugger is available
We focus here on the design mode.
· Six windows appear when you start Visual Basic.
Þ
The Main Window consists of the title bar, menu bar, and toolbar. The title bar indicates the project name, the current Visual Basic operating mode, and the current form. The menu bar has drop-down menus from which you control the operation of the Visual Basic environment. The toolbar has buttons that provide shortcuts to some of the menu options. The main window also shows the location of the current form relative to the upper left corner of the screen (measured in twips) and the width and length of the current form.
The Main Window consists of the title bar, menu bar, and toolbar. The title bar indicates the project name, the current Visual Basic operating mode, and the current form. The menu bar has drop-down menus from which you control the operation of the Visual Basic environment. The toolbar has buttons that provide shortcuts to some of the menu options. The main window also shows the location of the current form relative to the upper left corner of the screen (measured in twips) and the width and length of the current form.
|
|
No comments:
Post a Comment