Other Controls
Transcript of Other Controls
-
8/14/2019 Other Controls
1/41
IT Training Module 5 VISUAL BASIC 6 1
Other VBther VBControlsontrols
-
8/14/2019 Other Controls
2/41
IT Training Module 5 VISUAL BASIC 6 2
A. Image. Image
-
8/14/2019 Other Controls
3/41
ImageImag
e
Image control displaysImage control displays
pictures on a formpictures on a form
-
8/14/2019 Other Controls
4/41
Code:Code:
-
8/14/2019 Other Controls
5/41
Output:Outp
ut:
At Run-Time
When the SHOW IMAGEclicked
At the Form Window
-
8/14/2019 Other Controls
6/41
IT Training Module 5 VISUAL BASIC 6 6
B. Picture Box. Picture Box
-
8/14/2019 Other Controls
7/41
Picture BoxPicture Box
Picture Box acts as aPicture Box acts as acontainer for picturecontainer for picture
and even otherand even other
controls.controls.
-
8/14/2019 Other Controls
8/41
Code:Code:
-
8/14/2019 Other Controls
9/41
Output:Output:
At Run-
Time
When the CHANGE
PICTUREis clicked
-
8/14/2019 Other Controls
10/41
IT Training Module 5 VISUAL BASIC 6 10
C. The Frame. The Frame
-
8/14/2019 Other Controls
11/41
FrameFrameFrame is used to groupFrame is used to group
several controls. When theseveral controls. When theframe is moved, all theframe is moved, all the
controls inside will movecontrols inside will move
together with the frame.together with the frame.
The frame should beThe frame should be
created first before puttingcreated first before putting
the other controls..the other controls..
The common controlsThe common controlsplaced inside a frame areplaced inside a frame are
the option buttons and thethe option buttons and the
check boxes.check boxes.
Frame
-
8/14/2019 Other Controls
12/41
IT Training Module 5 VISUAL BASIC 6 12
D. Option. OptionButtonsuttons
-
8/14/2019 Other Controls
13/41
Option ButtonsOption Buttons
Option buttons are alsoOption buttons are also
called radio buttons. Itcalled radio buttons. It
is used to allow usersis used to allow users
to select only oneto select only onebutton at a time in abutton at a time in a
group of options.group of options.
Option buttons areOption buttons are
grouped and usuallygrouped and usually
placed inside a frame.placed inside a frame.
-
8/14/2019 Other Controls
14/41
Code:Code:
-
8/14/2019 Other Controls
15/41
Output:Output:
When Option Buttonsare clicked
-
8/14/2019 Other Controls
16/41
IT Training Module 5 VISUAL BASIC 6 16
E. Check Box. Check Box
-
8/14/2019 Other Controls
17/41
Check BoxCheck Box
Check boxes allowCheck boxes allowusers to select severalusers to select several
boxes at a time in aboxes at a time in a
group of options.group of options.
Check boxes areCheck boxes are
grouped and aregrouped and areusually placed inside ausually placed inside a
frame.frame.
-
8/14/2019 Other Controls
18/41
Code:Code:
-
8/14/2019 Other Controls
19/41
Output:Output:
At Run-time
When theCLICK buttonis clicked
-
8/14/2019 Other Controls
20/41
IT Training Module 5 VISUAL BASIC 6 20
F. List Box. List Box
-
8/14/2019 Other Controls
21/41
List BoxList Box
List box presents a listList box presents a list
of choices to the userof choices to the user
and allows them toand allows them to
choose one or morechoose one or more
choices.choices.
-
8/14/2019 Other Controls
22/41
Code:Code:
-
8/14/2019 Other Controls
23/41
Output:Output:
At Run-timeWhen list items are clicke
When list items are double-clicked
-
8/14/2019 Other Controls
24/41
IT Training Module 5 VISUAL BASIC 6 24
G. Combo Box. Combo Box
-
8/14/2019 Other Controls
25/41
-
8/14/2019 Other Controls
26/41
Code:Code:
-
8/14/2019 Other Controls
27/41
Output:Output:
At Run-time When the down-arrow is click
-
8/14/2019 Other Controls
28/41
Output:Output:
When the ADD button
is clicked
When a list item is
double-clicked
-
8/14/2019 Other Controls
29/41
IT Training Module 5 VISUAL BASIC 6 29
ANDS-ON ACTIVITYANDS-ON ACTIVITY 1. Create a program that will allow the
user to select a course in college.
2. Once the user selects an option anda button is pressed, the description
of the course will appear.
Form name: College Course
Project name: Course Description
Time Allotment:
30 minutes
-
8/14/2019 Other Controls
30/41
IT Training Module 5 VISUAL BASIC 6 30
MultimediaultimediaControlontrol
-
8/14/2019 Other Controls
31/41
MultimediaMultimedia
Multimedia is the useMultimedia is the use
of computers to playof computers to playsounds, watch videos,sounds, watch videos,
record music andrecord music and
present text, graphicspresent text, graphicsand animations.and animations.
-
8/14/2019 Other Controls
32/41
Creating a Multimedia DeviceCreating a Multimedia Device
1.1. Create a new project.2. Right-click the Toolbox and
choose Components.
3. Check the box beside MicrosoftMultimedia Control 6.0.
C ti M lti di D iCreating
a M ltimedia De ice
-
8/14/2019 Other Controls
33/41
Creating a Multimedia DeviceCreating 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
to create.DEVICE TYPE DEVICE
CDAudio CD Audio Player
DAT Digital audio tape player
Overlay Overlay
Scanner Scanner
Ver Videotape player andrecorder
Videodisc Videodisc player
Other Other devices
-
8/14/2019 Other Controls
34/41
Creating a Multimedia DeviceCreating a Multimedia Device
6. Set the following run-time
properties using the code editor.
-
8/14/2019 Other Controls
35/41
Name Value Description
Track Contains thenumber of track
Command Open Opens thedevice
Close Closes thedevice
Eject Ejects the CD
Play Plays the device
Pause Pauses thedevice
Next Goes to nexttrack
Prev Goes to theprevious track
Record Initializesrecording
Save Saves the opendevice file
Seek Step backwardor forward a
-
8/14/2019 Other Controls
36/41
Code:Code:
-
8/14/2019 Other Controls
37/41
LETS ANALYZETHE 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
-
8/14/2019 Other Controls
38/41
LETS ANALYZETHE CODE!!!
Private Sub Form_Unload(Cancel AsInteger) once the Close button is clicked,
it wil call on the Form_Unload that will stop
playing the CD and close the multimediadevice
Private Sub MMControl1_StatusUpdate() displays the track being played once the
status of the multimedia control changes
-
8/14/2019 Other Controls
39/41
Output:Output:
At Run-time
O
-
8/14/2019 Other Controls
40/41
Output:Output:
To hide unused buttons, use the
Custom property of the multimedia
control. Choose the Controls tab.
-
8/14/2019 Other Controls
41/41
IT T i i M d l 5 VISUAL BASIC 6 41
ANDS-ON ACTIVITYANDS-ON ACTIVITY 1. Using Visual Basic, create your
own CD player.2. Do not show the buttons that will
not be used.
Form name: CD PlayerProject name: CD Player
Time Allotment:
20 minutes