0% found this document useful (0 votes)
79 views5 pages

Lesson1 - Introduction To VB

The document provides an introduction to Visual Basic, including what it is, its features, the structure of a Visual Basic application including forms, controls, properties, methods, and event procedures. It also outlines the steps to develop an application including drawing the user interface, assigning properties, and attaching code. Details are given about the Visual Basic integrated development environment and its components like the menu bar, toolbox, project explorer, and properties window.

Uploaded by

polycarpkamolo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views5 pages

Lesson1 - Introduction To VB

The document provides an introduction to Visual Basic, including what it is, its features, the structure of a Visual Basic application including forms, controls, properties, methods, and event procedures. It also outlines the steps to develop an application including drawing the user interface, assigning properties, and attaching code. Details are given about the Visual Basic integrated development environment and its components like the menu bar, toolbox, project explorer, and properties window.

Uploaded by

polycarpkamolo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

INTRODUCTION TO VB

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.

Features of Visual Basic

- Full set of objects - you 'draw' the application


- Lots of icons and pictures for your us e
- 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
Structure of a Visual Basic Application
 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
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.

The Integrated Development Environment

One of the most significant changes in Visual Basic 6.0 is the Integrated Development Environment
(IDE). IDE is a term commonly used in the programming world to describe the interface and
environment that we use to create our applications. It is called integrated because we can access
virtually all of the development tools that we need from one screen called an interface. The IDE is also
commonly referred to as the design environment, or the program.

The Visual Basic IDE is made up of a number of components

 Menu Bar
 Tool Bar
 Project Explorer
 Properties window
 Form Layout Window
 Toolbox
 Form Designer

Menu Bar

This Menu Bar displays the commands that are required to build an application. The main menu items
have sub menu items that can be chosen when needed. The toolbars in the menu bar provide quick
access to the commonly used commands and a button in the toolbar is clicked once to carry out the
action represented by it.

Toolbox
The Toolbox contains a set of controls that are used to place on a Form at design time thereby creating
the user interface area. Additional controls can be included in the toolbox by using the Components
menu item on the Project menu. A Toolbox is represented in below.

Toolbox window with its controls available commonly.

Control Description
Pointer Provides a way to move and resize the controls form
Displays icons/bitmaps and metafiles. It displays text or acts as a visual
PictureBox
container for other controls.
TextBox Used to display message and enter text.
Frame Serves as a visual and functional container for controls
CommandButton Used to carry out the specified action when the user chooses it.
CheckBox Displays a True/False or Yes/No option.
OptionButton control which is a part of an option group allows the user
OptionButton
to select only one option even it displays mulitiple choices.
ListBox Displays a list of items from which a user can select one.
Contains a TextBox and a ListBox. This allows the user to select an ietm
ComboBox
from the dropdown ListBox, or to type in a selection in the TextBox.
HScrollBar and These controls allow the user to select a value within the specified range
VScrollBar of values
Timer Executes the timer events at specified intervals of time
DriveListBox Displays the valid disk drives and allows the user to select one of them.
DirListBox Allows the user to select the directories and paths, which are displayed.
FileListBox Displays a set of files from which a user can select the desired one.
Shape Used to add shape (rectangle, square or circle) to a Form
Line Used to draw straight line to the Form
used to display images such as icons, bitmaps and metafiles. But less
Image
capability than the PictureBox
Enables the use to connect to an existing database and display
Data
information from it.
Used to link or embed an object, display and manipulate data from other
OLE
windows based applications.
Label Displays a text that the user cannot modify or interact with.

Project Explorer

Docked on the right side of the screen, just under the tollbar, is the Project Explorer window. The
Project Explorer as shown in in figure servres as a quick reference to the various elements of a project
namely form, classes and modules. All of the object that make up the application are packed in a project.
A simple project will typically contain one form, which is a window that is designed as part of a
program's interface. It is possible to develop any number of forms for use in a program, although a
program may consist of a single form. In addition to forms, the Project Explorer window also lists code
modules and classes.

Properties Window

The Properties Window is docked under the Project Explorer window. The Properties Window exposes
the various characteristics of selected objects. Each and every form in an application is considered an
object. Now, each object in Visual Basic has characteristics such as color and size. Other characteristics
affect not just the appearance of the object but the way it behaves too. All these characteristics of an
object are called its properties. Thus, a form has properties and any controls placed on it will have
propeties too. All of these properties are displayed in the Properties Window.

Object naming conversions of controls (prefix)

Form -frm
Label-lbl
TextBox-txt
CommandButton-cmd
CheckBox -chk
OptionButton -opt
ComboBox -cbo
ListBox-lst
Frame-fme
PictureBox -pic
Image-img
Shape-shp
Line -lin
HScrollBar -hsb
VScrollBar -vsb

You might also like