21
MS Visual Basic: An overview

Introduction to Visual Basic (Week 2)

Embed Size (px)

Citation preview

MS Visual Basic:An overview

MS Visual Basic

O Is object-oriented programming

development system for creating Windows

Application

O It is an event driven

Working with Visual Basic

Parts of the VB Screen

O Blank form – where you can make your

own application’s interface

O Project Explorer Window - which displays

the files that are created in your

application

O Properties Window – displays the

properties of controls and objects that are

created in your application

O Toolbox – contains all control needed for

developing a Visual Basic Application

Toolbox

Form Design Window

• This is where the user interface is

actually designing

Code Editor Window

• Allow the user to enter or type the

programming statements for VB program

Project Explorer Window

Properties Window

Form Layout

• Allows to specify the screen location of the forms

within a project

Steps in building the VB Application

ODesign the interface

OSet properties of the

controls (Objects)

OWrite the event procedures

Control Properties

O Sets the properties for the control to

determine its appearance and how

it will work with the event procedure.

In the properties window you can do the ff:

O Rename a caption

O Alter the appearance of the

form

O Change foreground and

background

O Change font type and size

O Enable or disable minimize

and maximize buttons

O Give special effects

Important points about setting up your control…

O Set the Caption Property of a

control clearly so that a user knows

what to do with that command.

O Use a meaningful name for the

Name Property because it is easier

to write and read the event

procedure and easier to debug or

modify the programs later.

The Toolbox

O It contains all the control needed for

developing a Visual Basic

Application

Text Box

• is the standard control for accepting input

from the user as well as to display the output

In this example the text boxes

are used for input and the other

one is to display the sum of two

numbers that

are entered into the two text

boxes.

Label

O it is not only used to provide

instructions and guides to the

users, it can also be used to display

outputs. One of its most important

properties is Caption. Using the

syntax label.Caption, it can display

text and numeric data .

Command Button

O one of the most important controls as it isused to execute commands. The mostcommon event associated with thecommand button is the Click event, andthe syntax for the procedure is:

Private Sub Command1_Click ()

Statements

End Sub

Activity 1

Create and design your own user

interface in finding the Area of a

Rectangle.

Include: Textbox, Label and

Command button