UNIT -2
1. INTRODUCTION TO VISUAL BASIC
Programming means designing a set of instructions to instruct the computer to carry out certain jobs
that are very much faster than human beings can do. The earliest programming language is called machine
language which uses the binary code(comprises 0 and 1) to communicate with the computer. Basic.
What is Visual Basic?
Visual Basic is a third-generation event-driven programming language first released by Microsoft in 1991.
It evolved from the earlier DOS version called BASIC. BASIC means Beginners' All-
purpose Symbolic Instruction Code. Since then Microsoft has released many versions of Visual Basic, from
Visual Basic 1.0 to the final version Visual Basic 6.0. Visual Basic is a user-friendly programming language
designed for beginners, and it enables anyone to develop GUI window applications easily.
STEPS IN VB APPLICATION
1. Introduction Visual Basic implements graphical user interface that allows the use of graphics for different
applications. It provides visual interactive windows with user, like Dialogue box for (color, font ...), Input
box, and Output box. Also it is able to create menu to simplify user application.
To run this program on user computer:
Start>programs>Microsoft Visual Studio 6.0>Microsoft Visual Basic 6.0.
It will appear on the computer screen as in the following picture. To exit from Visual Basic and return to
Windows is like exit from most Windows applications.
There are three ways to close the Visual Basic as stated below.
1- Click on close button icon that appears in the upper-left corner of the screen.
2- Press Alt+F4
3- Select File >Exit
a) To create project:
When program starts, project box appears-select Standard EXE > Project window appears. OR: File> New
project> Box (select Standard EXE)> Project window appears
b) To add project:
Any number can be added. Project icon> Select Standard EXE> Project window appears. Note: Usually
first project runs first, but user can change that by: Selecting project from project window > mouse list >
Set as startup.
c) To open an existing project:
It is previously designed and saved on disc in a folder. File> Open project> Box (select existing and look
for the project) > Project window
,d) To delete a project:
Select project in Project window > Mouse list > Remove project.
e) To save project:
The visual basic can save the project on disc in two ways, as an executable type or a non-
executable type. I- for project in non execution stage:
There are many types of files summarized as follows: 1- Project file: it consists of all files which
are related to specific project, also some other information with it.
This could be saved with extension (.VBP) 2- The form Files: this contains form description and
any Object or program related to it .This is saved with extension (.frm).
Start a New Project Run the Visual Basic software from the list of programs or a desktop shortcut
icon. A appear.A window as same as the following picture will appear.
Click "Standard EXE".
Start a Standard .exe type of project. In the beginner level, you will only learn about this type of
project. Other project types on this window are for the advanced learners.
You can do a lot of things implying VB6 is giving you enough power in your hand through these
different project types
INTEGRATED DEVELOPMENT ENVIRONMENT(IDE)
Tha 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
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.
In particular, VB has the following windows:
Menu / Toolbar
This is the only element of the IDE which is always visible. You use it to select which other IDE
elements to view and to add forms or controls to your project. There are many other features which
we will discuss later
Toolbox
The toolbox is simply a library of controls which you can place on your application. Once you've
placed all the controls you need onto your applications forms, you can hide the toolbox to make
room for working in the other elements of the IDE.
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 to
OptionButton
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 information
Data
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 Window
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..
1. INTRODUCTION TO VISUAL BASIC
Programming means designing a set of instructions to instruct the computer to carry out certain jobs
that are very much faster than human beings can do. The earliest programming language is called machine
language which uses the binary code(comprises 0 and 1) to communicate with the computer. Basic.
What is Visual Basic?
Visual Basic is a third-generation event-driven programming language first released by Microsoft in 1991.
It evolved from the earlier DOS version called BASIC. BASIC means Beginners' All-
purpose Symbolic Instruction Code. Since then Microsoft has released many versions of Visual Basic, from
Visual Basic 1.0 to the final version Visual Basic 6.0. Visual Basic is a user-friendly programming language
designed for beginners, and it enables anyone to develop GUI window applications easily.
STEPS IN VB APPLICATION
1. Introduction Visual Basic implements graphical user interface that allows the use of graphics for different
applications. It provides visual interactive windows with user, like Dialogue box for (color, font ...), Input
box, and Output box. Also it is able to create menu to simplify user application.
To run this program on user computer:
Start>programs>Microsoft Visual Studio 6.0>Microsoft Visual Basic 6.0.
It will appear on the computer screen as in the following picture. To exit from Visual Basic and return to
Windows is like exit from most Windows applications.
There are three ways to close the Visual Basic as stated below.
1- Click on close button icon that appears in the upper-left corner of the screen.
2- Press Alt+F4
3- Select File >Exit
a) To create project:
When program starts, project box appears-select Standard EXE > Project window appears. OR: File> New
project> Box (select Standard EXE)> Project window appears
b) To add project:
Any number can be added. Project icon> Select Standard EXE> Project window appears. Note: Usually
first project runs first, but user can change that by: Selecting project from project window > mouse list >
Set as startup.
c) To open an existing project:
It is previously designed and saved on disc in a folder. File> Open project> Box (select existing and look
for the project) > Project window
,d) To delete a project:
Select project in Project window > Mouse list > Remove project.
e) To save project:
The visual basic can save the project on disc in two ways, as an executable type or a non-
executable type. I- for project in non execution stage:
There are many types of files summarized as follows: 1- Project file: it consists of all files which
are related to specific project, also some other information with it.
This could be saved with extension (.VBP) 2- The form Files: this contains form description and
any Object or program related to it .This is saved with extension (.frm).
Start a New Project Run the Visual Basic software from the list of programs or a desktop shortcut
icon. A appear.A window as same as the following picture will appear.
Click "Standard EXE".
Start a Standard .exe type of project. In the beginner level, you will only learn about this type of
project. Other project types on this window are for the advanced learners.
You can do a lot of things implying VB6 is giving you enough power in your hand through these
different project types
INTEGRATED DEVELOPMENT ENVIRONMENT(IDE)
Tha 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
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.
In particular, VB has the following windows:
Menu / Toolbar
This is the only element of the IDE which is always visible. You use it to select which other IDE
elements to view and to add forms or controls to your project. There are many other features which
we will discuss later
Toolbox
The toolbox is simply a library of controls which you can place on your application. Once you've
placed all the controls you need onto your applications forms, you can hide the toolbox to make
room for working in the other elements of the IDE.
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 to
OptionButton
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 information
Data
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 Window
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..