Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
OBJECTIVES:
1. Define Visual Basic programming.
2. Name and define the parts of visual Basic 6.0 graphical interface.
System Requirements:
• PC with at least 586/66 or higher processor(Pentium or higher processor
recommended) or any alpha processor running Microsoft Windows NT
workstations.
• A hard disk with a minimum of 100 megabytes available space for a full
installation.
• Minimum installation: 35 MB
Visual Basic allows the user to use the functionality provided by other
applications such as MS Word, MS Excel and other applications.
• Visual Basic has a well defined structure. Each form created is treated as a
separate file known as a form module. A form module contains information on
instances of controls drawn on the form. A group of statements is referred to
as code.
A project file lists each form, as well as the information about the different types
of controls in each form. Note that each program has a single project file,
regardless of the number of modules.
Ball object
----
Color attribute
----
Blue value
----
Roll/bounc method
e
You can use any of these tabs to get you started on a project. You may
notice a small checkbox at the bottom part of the start up page saying,
“Don’t show this dialog in the future.” If you prefer not to be bothered with
this page or selecting a type of project, you can check this box, and the
window will not appear the next time you open the Visual Basic application.
IDE is a term used to describe the user interface and environment used to
create applications. It is termed Integrated because the programmers can access
virtually all the tools needed from one screen, called an interface. Another
commonly term use to refer the IDE are design environment and/or the program.
Properti
es
Fig. 1.3 Window
The Integrated
Development
Environment of
Visual Basic 6.0
Properti
es
Window
The Title bar is at the topmost portion of a program. It normally contains the name
of the application.
Menu bar
The Menu bar holds the total control over Visual Basic application. This also contains
commands used to
create, manipulate and run an application.
Toolbar
The Toolbar is a set of tools available for the programmer. This duplicates many of
the commands in the
menu bar and provides instant access to frequently used commands.
Form Layout Window
The Form Layout window is a window where you create the user interface for the
program. It also shows
the exact location of the form in the Visual Basic IDE.
Toolbox
The Toolbox is a set of drag and drop tools which serve as controls and manipulated
through codes. These drag and drop tools are necessary to create the user interface
for a form.
Close button
Pointer Pointer
Shape Line
Image Data
Properties Window
This window displays set of attributes and values needed to manipulate controls.
The name and the caption property is said to be the most used and abused
window set of attributes, called properties. Different objects have different set of
properties that includes size, color, alignment, visibility and appearance.
• Access the View menu > Select Properties window or simply press F4 in your
keyboard. Resize the window if necessary.
Fig 1.5 The Properties Window of a Form Fig. 1.6 The Properties Window of
a command button
Figures 1.5 and 1.6 showing that each control has different properties.
The properties window has two columns. The NAME column, which lists the name of
the property and the VALUE column which lists the current value of a property.
Note: You can use the scroll bar to view the list of properties if the entire list does
not fit within the window.
2. Categorized tab when active, allows the programmer to view the properties
applicable to the controls and is presented by category.
The properties window also has its own title bar and a control box at the top left
portion. The minimize button when clicked, will reduce the Properties window of an
icon. To hide or close this window, click on the X mark button of the control box.
Press F4 to view the window.
Code Window
This window serves as the area that displays the set of BASIC codes or
actions and events assigned by the programmer.
The Visual Basic 6.0 Code Window
Object List
box
Procedure
List box
Codes
• Click the Project Explorer window, and click the View Code button or
• Double click the form or any controls in the form or
• Object List Box. This box shows the objects of the current form and the
difference controls.
• Procedure List Box. This box lists the different event procedures to which the
object can respond. These procedures depend on the types of object selected
for different object respond to different events.
Event
Procedures
• Make sure the menu bar and standard toolbar check boxes are checked, then
clear any other check boxes.
• Position mouse pointer over the Add Standard EXE project at the left portion
of the toolbar.
• The tool tip appears and displays Add Standard EXE Project.
Note: the tool tip disappears when the user moves the mouse pointer away
from the button.
How to configure the Visual Basic IDE
• Tools menu > Options > click the Advanced Tab in the Options dialog.
• Click Ok.
The Project Explorer displays the hierarchical list of all forms and modules
created and used in the
project. Each line include the following terms:
- Box contains the plus and minus sign. Plus means opening a folder and
displaying its content. Minus means closing the folder and its content.
View
Code
Form
Name
Form is a window used to create the user interface for any applications. The user
interface may
include menus, dialog boxes, command buttons, and images that is
used manipulate a program.
• Open Visual Basic > New Project > Standard EXE. You will then see
the various parts of a single form object (See figure 1.5). The next part
will discuss the parts and functions of the form’s anatomy.
Let’s take a look at how these form features are used in Visual Basic
6.0.
Caption Title bar
Control menu
Control box
Border
The Border
The Border is what makes the form elastic by default. The program can program
the form’s border to be fixed, sizable or even nonexistent. This can be set using the
property, BorderStyle.
The title bar is on top of most forms. This shows the name of the form. You can drag
the title bar to move the window around the screen. In addition, a double click will
alternately maximize and restore the form window.
The Caption
This is the text that you see in the form’s title bar. This is used to identify the name
of the application. The caption to appear in the title bar depends on what the
programmers are trying to achieve.
Note: If the programmer set a form’s BorderStyle property to None, then the
caption will be hidden. You can decide what caption fits your application using the
Caption property in the properties window.
This is a simple menu that allows the user to restore, move , resize, maximize,
minimize, and close a form. Set the form’s ControlBox property to True in the
properties window to enable this button.
The Control box
This box allows the user to minimize, maximize and close the current window. The
user can control whether the control box will be visible on screen or not.