THE
VISUAL BASIC ENVIRONMENT
The visual Basic environment is
where you create and run your project
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 window
- Properties window
- Form Layout Window
- Toolbox
- Form Designer
- Object Browser
In previous versions of Visual
Basic, the IDE was designed as a Single Document Interface (SDI). In a Single
Document Interface, each window is a free-floating window that is contained
within a main window and can move anywhere on the screen as long as Visual
Basic is the current application. But, in Visual Basic 6.0, the IDE is in a
Multiple Document Interface (MDI) format. In this format, the windows
associated with the project will stay within a single container known as the
parent. Code and form-based windows will stay within the main container form.
The
Form Window
The
form window is where you design form that make up your user interface. When you begin a new project the visual basic
gives your new form the default name Form1. As soon as you save the file you
give a new meaningful name.
The Project Explorer Window
This holds the filenames for the
files included in the project. The windows title bar holds the name of your
project (.vbp) file which is project1 by default until you save it with a new
name. The Project Window displays a list of all forms and modules making
up your application. You can also obtain a view of the Form or Code windows
(window containing the actual Basic coding) from the Project window.
Properties Window
This
is used to set properties for the objects in your project. The Properties
Window is used to establish initial property values for objects. The
drop-down box at the top of the window lists all objects in the current form.
Two views are available: Alphabetic and Categorized. Under this box are the
available properties for the currently selected object.
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
figure 2 shown below.
Toolbox window with its
commonly available controls
|
Control
|
Description
|
|
Pointer
|
Provides
a way to move and resize the controls form
|
|
PictureBox
|
Displays
icons/bitmaps and metafiles. It displays text or acts as a visual 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
|
OptionButton
control which is a part of an option group allows the user to select only one
option even if it displays mulitiple choices.
|
|
ListBox
|
Displays
a list of items from which a user can select one.
|
|
ComboBox
|
Contains
a TextBox and a ListBox. This allows the user to select an ietm from the
dropdown ListBox, or to type in a selection in the TextBox.
|
|
HScrollBar
and VScrollBar
|
These
controls allow the user to select a value within the specified range 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
|
|
Image
|
used
to display images such as icons, bitmaps and metafiles. But less capability
than the PictureBox
|
|
Data
|
Enables
the use to connect to an existing database and display information from it.
|
|
OLE
|
Used
to link or embed an object, display and manipulate data from other windows
based applications.
|
|
Label
|
Displays
a text that the user cannot modify or interact with.
|
NAMIMG
RULES AND CONVENTIONS FOR OBJECTS, PROCEDURES AND VARIABLES
Using
good meaningful and consistent names for objects makes projects easier to read
and understand as well as easier to debug.
NAMING RULES FOR AN OBJECT
·
Must select a name for an object
·
The name must begin with letter
·
Can be up to 40 characters in length
·
Can contain letters digits and
underscore
·
An object name should not include a
space or punctuation mark
|
||||||
|
||||||
OBJECT NAMING CONVENTION
A
convention has been established for naming Visual Basic objects. This convention
is to use a three letter prefix (depending on the object) followed by a name
you assign. A few of the prefixes are (we’ll see more as we progress in the
class):
Object
Prefix
Example
Form
frm
frmWatch
Command
Button cmd cmdExit
Label
lbl
lblStart,
lblEnd
Text
Box txt txtTime,
txtName
Menu
mnu
mnuExit,
mnuSave
Check
box chk
chkChoice
Prefix
Control Prefix
Control
Cbo
combo box chk check box
cmd command
button dir directory list
box
drv
drive list box fil file list box
fil file
list box fra
frame
frm form
grd grid
hsb horizontal
scrollbar
img image
lbl
label
lin line
lst
list box mnu menu
ole OLE
client opt
option button
pic
picture box
shp shape
tmr
timer
txt text box
vsb vertical scrollbar
NAMING RULES AND CONVENTIONS FOR VARIABLES AND CONSTANTS
·
Names must not be more than 255
characters
·
May consist of letter, digits and
underscore
·
Must not contain any space or period
·
Must not be a reserved word (aka
keywords)
·
Give meaningful names to your variables
and constants, do not use short names such as x or y
·
Precede each variable with a lower case
prefix that specifies its data type
·
Capitalize each word of the name, always
use mixed case, never use upper case all through





>>>>> Download Now
ReplyDelete>>>>> Download Full
>>>>> Download LINK
>>>>> Download Now
>>>>> Download Full
>>>>> Download LINK Gs