Вы находитесь на странице: 1из 41

Other VB

Controls

IT Training Module 5 VISUAL BASIC 6 1


A. Image

IT Training Module 5 VISUAL BASIC 6 2


Image

Image control displays


pictures on a form
Code:
Output:

At Run-
At the Form Window Time

When the SHOW IMAGE


clicked
B. Picture Box

IT Training Module 5 VISUAL BASIC 6 6


Picture Box

Picture Box acts as a


container for picture
and even other
controls.
Code:
Output:

At Run- When the CHANGE


Time PICTURE
is clicked
C. The Frame

IT Training Module 5 VISUAL BASIC 6 10


Frame
Frame is used to group
several controls. When the
frame is moved, all the
Frame
controls inside will move
together with the frame.
The frame should be
created first before putting
the other controls..
The common controls
placed inside a frame are
the option buttons and the
check boxes.
D. Option
Buttons

IT Training Module 5 VISUAL BASIC 6 12


Option Buttons

Option buttons are also


called radio buttons. It
is used to allow users
to select only one
button at a time in a
group of options.

Option buttons are


grouped and usually
placed inside a frame.
Code:
Output:

When Option Buttons


are clicked
E. Check Box

IT Training Module 5 VISUAL BASIC 6 16


Check Box

Check boxes allow


users to select several
boxes at a time in a
group of options.

Check boxes are


grouped and are
usually placed inside a
frame.
Code:
Output:

At Run-
time

When the
CLICK button
is clicked
F. List Box

IT Training Module 5 VISUAL BASIC 6 20


List Box

List box presents a list


of choices to the user
and allows them to
choose one or more
choices.
Code:
Output: At Run-timeWhen list items are clicked

When list items are double-clicked


G. Combo Box

IT Training Module 5 VISUAL BASIC 6 24


Combo Box

Combo box comes from


the word combination
box. It combines the
function of a text box and
a list box. In combo box,
a list of choices is
presented and the user
will respond either by
selecting or typing into
the box.
Code:
Output:

At Run-time When the down-arrow is clicke


Output:

When the ADD button When a list item is


is clicked double-clicked
Time Allotment:
HANDS-ON ACTIVITY 30 minutes

1. Create a program that will allow the


user to select a course in college.
2. Once the user selects an option and
a button is pressed, the description
of the course will appear.

Form name: College Course


Project name: Course Description
IT Training Module 5 VISUAL BASIC 6 29
Multimedia
Control

IT Training Module 5 VISUAL BASIC 6 30


Multimedia

Multimedia is the use


of computers to play
sounds, watch videos,
record music and
present text, graphics
and animations.
Creating a Multimedia Device

1. Create a new project.


2. Right-click the Toolbox and
choose Components.
3. Check the box beside Microsoft
Multimedia Control 6.0.
Creating a Multimedia Device

4. Click the MMControl on the


Toolbox and draw a Multimedia
control on the form.

5.On the DeviceType property,


choose the type of device you want
DEVICE TYPE DEVICE
to create. CDAudio CD Audio Player
DAT Digital audio tape player

Overlay Overlay
Scanner Scanner
Ver Videotape player and
recorder
Videodisc Videodisc player
Other Other devices
Creating a Multimedia Device

6. Set the following run-time


properties using the code editor.
Name Value Description

Track Contains the


number of track

Command Open Opens the


device
Close Closes the
device
Eject Ejects the CD
Play Plays the device

Pause Pauses the


device
Next Goes to next
track
Prev Goes to the
previous track
Record Initializes
recording
Save Saves the open
device file
Seek Step backward
or forward a
Code:
LET’S ANALYZE
THE CODE!!!

Private Sub Form_Load() - once the form


is loaded it will automatically open the
device and play the CD.

Private Sub cmdClose_Click() - closes


the form and unloads it from the memory
LET’S ANALYZE
THE CODE!!!

Private Sub Form_Unload(Cancel As


Integer) – once the Close button is clicked,
it wil call on the Form_Unload that will stop
playing the CD and close the multimedia
device

Private Sub MMControl1_StatusUpdate()


– displays the track being played once the
status of the multimedia control changes
Output:

At Run-time
Output:

To hide unused buttons, use the


Custom property of the multimedia
control. Choose the Controls tab.
Time Allotment:
HANDS-ON ACTIVITY 20 minutes

1. Using Visual Basic, create your


own CD player.
2. Do not show the buttons that will
not be used.

Form name: CD Player


Project name: CD Player

IT Training Module 5 VISUAL BASIC 6 41

Вам также может понравиться