1st lab session
TRANSCRIPT
-
7/24/2019 1st Lab Session
1/28
1STLAB SESSION
-
7/24/2019 1st Lab Session
2/28
INTRODUCTION Three mode :
Design time
Run Time
Break Time
-
7/24/2019 1st Lab Session
3/28
TYPES OF FILE IN VB PROJECT A project .vbp
A form .frm
A module .bas
A workspace.vbw A control set .ocx
-
7/24/2019 1st Lab Session
4/28
pen !icrosoft "isual Basic #.$ in %our
computer please&
-
7/24/2019 1st Lab Session
5/28
VISUAL BASIC ENVIRONMENT
'. (orm
-
7/24/2019 1st Lab Session
6/28
DETERMINE THE SIZE OF THE
FORM
Border is being dragged.
(igure '.': Determine the si)e of the form
-
7/24/2019 1st Lab Session
7/28
DESCRIPTION OF THE PROPERTIES
Name Of The
Property
Description Of The Property
Name Name referred to in code window.
Caption Name of the object that will be seen on the title bar.
Icon Icons that will be displayed when the form is
minimised.MaxButton
and MinButton
Determine if the form can be minimised or
maximised.
WindowState Determine the start up position, whether it
is maximised, minimised or put in the normal size.
Heiht and
Width
Determining the size of the form.
!eft and Top Determining the location of the form, from
the upper left corner.
Table '.$: Description f The *roperties
-
7/24/2019 1st Lab Session
8/28
+. *roject ,xplorer
-
7/24/2019 1st Lab Session
9/28
-. *roperties indow
The list of
*roperties
Description of
each properties
-
7/24/2019 1st Lab Session
10/28
/. Toolbox0abel
(rame
1heckBox
1omboBox
23crollBar
Timer
Dir0istBox
3hape
4mage
0,
*ictureBox
Textbox
1ommandButton
ptionButton
0istBox
"3crollBar
Drive0istBox
(ile0istBox
0ine
Data
-
7/24/2019 1st Lab Session
11/28
Text Boxes
5se when %ou want the user to t%pe some
input or displa% output.
,xample :
5se Text*ropert%.
*refix naming 6 7txt89txtTitle.
Text Box
-
7/24/2019 1st Lab Session
12/28
Progra Co!e For Text Boxes
,xample ' :
lbl;ame.1aption < txt;ame.Text
=4nputfrom user enter into the text box isassignedto the caption propert% of lbl;ame.
,xample + :
txt!essage.Text < >atson? come here@
=Displa% textin a text box during program
execution? assign a literal to the Text propert%.
-
7/24/2019 1st Lab Session
13/28
Fraes 5se as containersfor other controls.
,xample :
roupsof option buttons or check boxes.
!ake form easierto understand.
*refix naming 6 fra9fra1olor.
(orms must be drawn first than onl% option buttons
into the frame.
-
7/24/2019 1st Lab Session
14/28
C"e#$ Boxes
Allow the user to select 9or deselectan option. ,xample :
4n an% group of check boxes? an% numberma% be
selected. "alue propert%of a check box is set to $if
unchecked? 'if checked? or +if gra%ed9disabled. *refix naming 6 7chk8 9chkBold.
-
7/24/2019 1st Lab Session
15/28
Progra Co!e For C"e#$ Boxes
= 3et the initial value for check boxes :
Example 1 :
chkBold.Value = 1 Make box checkedchkBold.Value = 0 Make box unchecked
Example 2 :
chkBold.Value = Checked Make box checkedchkBold.Value = Unchecked Make box unchecked
-
7/24/2019 1st Lab Session
16/28
O%t&o' B(tto's
5se when onl% one button of a groupma% beselected.
,xample :
"alue propert%of an option button is set toTrueif selectedor to (alseif unselected.
*refix naming 6 7opt8 9optRed.
-
7/24/2019 1st Lab Session
17/28
Lo#ate T"e O%t&o' B(tto'
An% option button placeddirectl% on the
form9not in a frame function as single
event.
A group of option buttons inside a frame
function together.
* The best method is to first create a frame and then create eachoption button inside the frame.
* Must be careful to create the button inside the frame, dont
create it on the form and drag it inside the frame its still
belongs to the forms group, not the frames group.
-
7/24/2019 1st Lab Session
18/28
Progra Co!e For O%t&o' B(tto'
= To make an option button appear selected
initiall% :
Example :
optRed. Value = True Make button selected
-
7/24/2019 1st Lab Session
19/28
Iages
1ontrol that holds a picture.
,nable to set an image8s *icture propert%to
a file with an extension of .bmp? .wmf?
.ico? .dib? .gif? .jpg? .emf? or .cur. 3et 3tretch propert%to Trueto make the
picture enlargeto fill the control.
3et "isible propert%to (alseto make the
image disappear. *refix naming 6 7img8 9img*icture.
-
7/24/2019 1st Lab Session
20/28
Progra Co!e For Iages
=!ake an image invisible at run time.
Example :
imgLogo.Visible = False
-
7/24/2019 1st Lab Session
21/28
Sett&'g a Bor!er a'! St)*e
!ost controls can appear to be -dimensional
or flat.
0abels? text boxes? check boxes? option
buttons and images all have an Appearancepropert%.
$ 6 (lat or ' 6 -D.
= To make a label or an image appear -D? %ou must give it aborder.
= 3et the Border3t%le to ' 6 (ixed 3ingle.
-
7/24/2019 1st Lab Session
22/28
S"a%e Co'tro* *lace shapeson a form :
i Rectangleii 3Cuares
iii vals
iv 1ircles
,xample :
*refix naming 6 7shp8 9shp1ircle.
-
7/24/2019 1st Lab Session
23/28
S"a%e %ro%ert)
Determine the shape b% settingits 3hape
propert%:
$ Rectangle' 3Cuares
+ vals
- 6 1ircles
/ 6 Rounded Rectangle
6 Rounded 3Cuares
-
7/24/2019 1st Lab Session
24/28
L&'e
Draw lineon a form.
,xample :
*refix naming 6 7lin8 9lin0ogo.
0ine
-
7/24/2019 1st Lab Session
25/28
CREATIN+ FIRST APPLICATION
Refer our module8s book at page '
-
7/24/2019 1st Lab Session
26/28
TRY DESI+N THIS INTERFACE,,
command
button
textboxlabel
-
7/24/2019 1st Lab Session
27/28
-
7/24/2019 1st Lab Session
28/28