Programming with Visual Basic
Visual Basic (VB) is a programming environment from Microsoft in which a
programmer uses a graphical user interface (GUI) to choose and modify
preselected sections of code written in the BASIC programming language.
VB IDE
• Standard.EXE: Should be used if the file is an executable.
• It will open a blank form to write your application.
Tool Box
Writing a VB Application
There are three basic steps to write a program.
Step 1 : Design the interface
Step 2 : Set Properties of the controls (Objects)
Step 3 : Write the events' procedures
Creating Your First Program
• Insert a LABEL and a COMMAND button on the form
• Double click on the FORM to open the CODE Window.
• The drop down menus will show the items you inserted in the form.
Procedure
box
Object box
Properties for controls in the toolbox
Property Description
BackColor Specifies the background color of the control.
BorderStyl
Generally, specifies whether or not a control has a border.
e
Text The string of text that is to be displayed in the control.
Enabled Determines whether or not the control can respond to user-generated events.
For controls displaying text, specifies the font (name, style, size, etc.) to be
Font
applied to the displayed text.
ForeColor Specifies the color of text or graphics to be displayed in the control.
Height Specifies the height of the control in pixels.
Specifies the distance (in pixels) between the internal left edge of a control and
Left
the left edge of its containter.
Name The string value used to refer to the control in code.
Image Specifies the graphic to be displayed in the control.
TabIndex Specifies the tab order of a control within its parent form,
Specifies whether or not the user can use the Tab key to give focus to the
TabStop
control.
Tag A string containing extra data associated with the control.
Specifies the distance (in pixels) between the internal top edge of a control and
Top
the top edge of its containter.
Visible Specifies whether the control is visible or hidden.
Width Specifies the width of the control in pixels.
Project Window
A Visual Basic program consists of several files that are linked together to make the program
run. The Visual Basic 6.0 development environment includes a Project window to help you
switch back and forth between these components as you work on a project.