Download as pdf or txt
Download as pdf or txt
You are on page 1of 457

1 Microsoft Visual Basic 6.

Chapter (1)

Introduction pum;csD;
1/ Microsoft Visual Basic 6.0 onf Programming rsm;a&;om;&mwGif toH;k
jyKaom Computer Language wpfckjzpfygonf/ ,cifu GWBASIC, BASIC,
BASICA, QBASIC wdkYrSwpfqifh,cktcgwGif Visual Basic 4.0, Visual Basic 5.0,
Visual Basic 6.0 (Windows Mode) wGiftoHk;jyKEdkifaom Programming Language
rsm;jzifha&;om;cJhMuygonf/ Visual rSmtjrifESifhoufqdkifaom[k t"dyÜg,f&NyD; BASIC
rSm Beginners All Purpose Symbolic Instruction Code [kt"dygÜ ,f&ygonf/
Visual Basic 6.0 pwifzGifhjcif;
2/ Windows 95 ESifh txufuGefysLwmpufwpfvHk;zGifhvdkufaomtcg Task Bar
ay:wGif Start udk Mouse jzifh Left Click ESyd &f rnf/ xdaYk emuf Program tm;a½G;cs,yf g/
Sub-Menu wpfckxyfrHay:vmrnf/ xdk Sub-Menu xJrS Microsoft Visual Basic
6.0 tm;a½G;ygu Visual Basic 6.0 tm;pwiftoH;k jyK&eftqifoifjh zpfaernf/ Desktop
nmzuftay:axmifhwGif Microsoft Office Short Cut Bar ½Sad eygu 4if; Bar wef;xJ
wGif Microsoft Visual Basic 6.0 Smart Icon jyyguvnf; Left Click ESyd jf cif;jzifv h nf;
aumif;? uGefysLwm Desktop ay:wGif Microsoft Visual Basic 6.0 Short Cut Icon
½Sdaeyguvnf; 4if; Short Cut Icon udk Double Click ESdyfjcif;jzifhvnf;aumif; ac:,l
toHk;jyKEdkifayonf/
3/ aemufwpfenf;rSm Start → Run udk Mouse Left Click vkyfvdkufygu
yH(k 1)ygtwdik ;f Run Dialog Box ay:vmrnf/

yHk(1)
uGefysLwmvufpJG 2

4/ Open nmzuf½dS List Box xJwGif Cursor 0ifaevdrfhrnf/ xdktcg Browse


udak ½G;yg/ VB6.EXE File ½Sd&mtqifhqifhodkY0ifNyD; OK udEk ydS yf gu Visual Basic 6.0
yGivhf mrnf/ yH(k 2)/

yHk(2)

Creating an Application y½dk*&rfwpfckudkpwiftajcwnfjcif;


5/ yxrOD;pGm Visual Basic Programming jzifh zm&if[dkufrS pifwD*&dwfodkY
ajymif;vJaomy½dk*&rfykpämukda&;om;&mwGif zm&if[dkufrS pifwD*&dwfodkYajymif;vJaom
Formula udok ½d &dS rnf/ Oyrm - C = 5/9 * (F-32)/
6/ y½dk*&rfwpfckudka&;om;&mwGif tqifh(3)qifh½Sdonf/ 4if;wdkYrSm-
(u) Create the interface/
( c) Set Properties/
( *) Write Code /
3 Microsoft Visual Basic 6.0

Create the interface tjyeftvSefqufoG,fcsufrsm;udkBudKwifpOf;pm;jcif;


7/ yxrOD;pGm Project topfwpfckudkzefwD;&rnf/ xdkYaMumifh Menu Bar wGif
½Sdaom File udak ½G;yg/ Pulldown Menu (or) Dropdown Menu wpfckay:vmrnf/
4if;xJrS New Project udka½G;&rnf/ yHk(3)/

yHk(3)

8/ xdt
k cg New Project Dialog Box wpfckay:vmNyD; yHkrSeftm;jzifh Stan-
dard EXE Smart Icon a½G;cs,fjcif;cHae&ygu OK uda
k ½G;cs,&f ygrnf/ yk(H 4)/
uGefysLwmvufpJG 4

yHk(4)

9/ zm&if[dkufrS pifwD*&dwfodkYajymif;vJrnfh y½dk*&rfa&;om;&ef Form1 qdkonfh


Form yHkpHwpfckay:vmrnf/ yHk(5)/

yHk(5)
5 Microsoft Visual Basic 6.0

10/ 4if; Form yHkpHwGif Text, Memory Variable rsm;zefwD;&eftwGuf Visual


Basic wGit
f qifoifyh g½Sad eaom Toolbox udak c:,l&rnfjzpfygonf/ Toolbox udrk awGU
ygu Menu Bar ½Sd View rSwqifha½G;yg/ yHk(6)/ xdktcg Toolbox ay:vmayrnf/
yHk(7)/

yHk(7)
yHk(6)

11/ Icon udktoHk;jyKí Fahrenheit Degree, Centigrade Degree


rsm;udk Form xJwGifa&;om;&rnf/ yHk(8)/

yHk(8)
uGefysLwmvufpJG 6

12/ þuJhodkY Fahrenheit Degree, Centigrade Degree rsm;udk zefwD;&mwGif


Form1 xJodkY Label Icon udka½G;í Drag and Drop vkyy f g&ef/ xdt
k cg Form1 xJwGif
yHk(9)ygyHkpHtwdkif;jzpfaernf/

yHk(9)

Set Properties *kPo


f wÅrd sm;udjk yifqifjcif;
13/ Label [kazmfjyonfh Text Frame udkjrifawGU&rnfjzpfNyD; 4if; Text Frame
ay:rS Mouse Right Click udEk ydS yf gu Short Cut Menu wpfckay:vmrnf/ yHk(10)/

yHk(10)
7 Microsoft Visual Basic 6.0

14/ 4if; Short Cut Menu \atmufqHk;jzpfaom Properties udak ½G;yg/ xdt
k cg
Label1 ESifhoufqdkifaom Properties udkyHk(11)ygtwdkif;jrifawGU&rnf/

yHk(11)

15/ yH(k 11)yg Properties - Label1 xJ½dS Label1 Label wGiyf g0ifaomtcsurf sm;
udk atmufygtwdkif;jyifqif&rnf -
(u) AutoSize - True
( c) BackStyle - 0 - Transparant
( *) Caption - Fahrenheit Degree = = = >
(C) Font - Font Size - 12, Font Style - Bold [kjyifqif
jznfhpGufNyD; Properties \ Close Button udka½G;&rnfjzpfonf/
16/ xdkenf;wl Centigrade Degree = = = > udkvnf; txufygtwdkif;zefwD;
&rnf/ xdkYaemuf Keyboard rS ocsFmqdkif&mudef;*Pef;rsm;½dkufxnfh&ef Text Box Icon
jzifh Fahrenheit Degree = = = > \nmzufwGifxyfrHzefwD;&ef/ xdkYaemuf Right
Click xyfrE H ydS yf g&ef/ xdt
k cg Short Cut Menu wpfckxyfrHay:vmrnf/ yHk(12)/
uGefysLwmvufpJG 8

yHk(12)

17/ 4if;rS Short Cut Menu \atmufqHk;jzpfaom Properties udak ½G;cs,&f rnf/
xdt
k cg Properties - Text1 Text1 TextBox ay:vmrnf/ yH(k 13)/

yHk(13)

18/ Text1 TextBox Properties wGifatmufygwdkYudkjyifqif&ef-


(u) Font - Font Size - 12, Font Style - Bold
( c) Text - Empty [kjyifqifjznfhpGufNyD; Properties \ Close
Button udk Left Click vkyy f g/ xdt
k cg Text1 TextBox Proper-
ties ydwfoGm;vdrfhrnf/ xdkenf;wl Text2 udkvnf; Text1 enf;wl
9 Microsoft Visual Basic 6.0

zefwD;xm;&rnf/ yHk(14)/ Text1 rSm zm&if[dkuf'D*&DtwGufjzpfí


Text2 rSm pifw*
D &dw'f *D &DtwGujf zpfygonf/

yHk(14)

Write Code y½dk*&rfa&;jcif;


19/ Fahrenheit Degree ½dkufoGif;&efjzpfaom Text Box ü*Pef;wpfck½dkufNyD;
<Enter> udE k ydS yf g/ Centigrade Degree udo k ufqikd &f m Text Box üazmfjyrnfjzpfonf/
Centigrade Degree ½dkufoGif;&efjzpfaom Text Box ü*Pef;wpfck½dkufNyD;<Enter>udk
ESyd yf gu Fahrenheit Degree udo k ufqikd &f m Text Box ütjyeftvSeaf zmfjyrnfjzpfonf/
þuJhodkYjyKvkyfí&Edkifap&ef Text1, Text2 TextBox wdkYwGif View Code (or) Pro-
gram rsm;a&;om;&rnfjzpfonf/ Program a&;om;&mü Text1 Box wGif Double
Click ESy d &f rnf/ xdt k cg Program a&;om;&eftqifoift h ajctaeay;vmrnf/ yH(k 15)/

yHk(15)
uGefysLwmvufpJG 10

20/ Text1 Text Box udk Double Click ESdyfí Private Sub Text1_Change()
ESihf End Sub ay:vmygu Procedure List Box udk Change tpm; KeyPress [kajymif;
&rnf/ xdkYaemuf Private Sub Text1_KeyPress(KeyAscii As Integer) ESifh End
Sub tMum;wGif atmufyg Program udka&;om;&efjzpfonf/ yHk(16)/

yHk(16)

21/ xdkenf;wl Text2 Text Box ud k Double Click ESdyfí Private Sub
Text2_Change ESifh End Sub ay:vmygu Procedure List Box udk Change tpm;
KeyPress [k ajymif;&rnf/ xdkYaemuf Private Sub Test2_KeyPress(KeyAscii As
Integer) ESifh End Sub tMum;wGif atmufyg Program udka&;om;&efjzpfonf/ yHk(17)/

yHk(17)

22/ 4if;zdkifudk odrf;vdkygu Menu Bar ½Sd File udka½G;NyD; Pulldown Menu wGif
yg0ifaom Save Project udka½G;&efjzpfonf/ yHk(18)? xdktcg Save File as Dialog
Box ay:vmrnf/ File Name List Box wGif extest001 [ka&;NyD; Save udk Mouse
Left Click vky& f rnf/ yH(k 19)/
11 Microsoft Visual Basic 6.0

yHk(18)

yHk(19)

23/ xdt
k cg Save Project As Dialog Box ay:vmNyD; File Name List Box
wGif extest1 [ka&;NyD; Mouse Left Click vkyf&rnf/ yHk(20)/ yxrodrf;aomzdkifrSm
Form File, Extension rSm .frm jzpfNyD; 'kwd,trnfjzifhodrf;aomzdkifrSm Visual Ba-
sic Project File, Extension rSm .Vbp jzpfygonf/
uGefysLwmvufpJG 12

yHk(20)

24/ xdt
k cg Project - Project Dialog Box wGif Project1(extest001.vbp)
ESifh Form1 (extest001.frm) [líyHk(21)ygtwdkif;jzpfay:vmayrnf/

yHk(21)

25/ udk Click vkyyf gu extest001 yHkpHay:vmrnfjzpfNyD; 4if;


Form udy k w
d v
f u
kd yf gu Close Button udka½G;&rnf/ yHk(22)/ udk Click
vkyyf gu Program a&;om;xm;onfrsm;udkawGU½Sd&rnf/ yHk(23)/
13 Microsoft Visual Basic 6.0

yHk(22)

yHk(23)

26/ txufyg Project File jzpfaom extest001 udk Run vdyk gu Menu Bar ½Sd
Run udka½G;yg/ xdkYaemuf Start udka½G;yg/ yHk(24)?(odkYr[kwf) Short Cut Key (or) Short
Hand Key taejzifh Function Key jzpfaom F5 udE k ydS í
f vnf;&Edik af yonf/ (odrYk [kw)f
Menu Bar atmuf½Sd Standard Toolbar rS Icon udk Left Click ESdyfjcif;
jzifhvnf;&Edkifayonf/ xdktcgyHk(25)ygtwdkif; Text Box xJwGif Cursor tqifoifh
a&muf½Sdaernf/

yHk(24)
uGefysLwmvufpJG 14

yHk(25)

27/ zm&if[dkuf'D*&DudkxnfhNyD; <Enter> ESdyfygu pifwD*&dwf'D*&DtajzwGufay;


rnf/ pifw*D &dw'f *D &Duxkd nfNh y;D <Enter> ESyd yf guvnf; zm&if[u
kd 'f *D &Duw
kd u
G af y;rnf/
rdrdBuKdufESpfouf&m Text Box udk*Pef;½dkufxnfhNyD; <Enter> ESdyfEdkifonfhtcGifhta&;½Sd
onf/ 4if; Form tm;ydwv f u kd yf gu Form1 \nmzuftay:axmifhwGif½Sdaom Close
Button udka½G;&rnf/

28/ Visual Basic 6.0 xJrx S u


G v f ykd gu Menu Bar ½Sd File udka½G;NyD; Pulldown
Menu \atmufqHk;jzpfaom Exit uda k ½G;&ygrnf/ xdtk cg Microsoft Visual Basic
Dialog Box wpfckay:vmrnf/ Yes udka½G;ygu aemufqHk; Current Project, Form
File wdkYudkodrf;oGm;NyD; Microsoft Visual Basic rSxGufoGm;ayrnf/ No udka½G;ygu
rodr;f bJxu G o
f mG ;ayrnf/ Cancel udka½G;ygu Microsoft Visual Basic 6.0 rSrxGub f J
,ciftwdik ;f tvkyv
f yk Ef ikd rf nfjzpfygonf/ yH(k 26)/

yHk(26)
15 Microsoft Visual Basic 6.0

29/ ½SdNyD;om; extest001 File udzk iG v


hf ykd gu Menu Bar ½Sd File udak ½G;yg/ xdt
k cg
Pulldown Menu ay:vmrnf/ 4if;rS udak ½G;yg/ xdtk cg Open
Project Dialog Box ay:vmNyD;4if;rS extest001.vbp udka½G;í Open udk Click ESy d &f ef
jzpfonf/ yH(k 27)/

yHk(27)

30/ odkYr[kwf extest001 File udzk iG v


hf ykd gu Menu Bar ½Sd File udak ½G;yg/ Exit
tay:½Sd Recent File xJwGif extest001.vbp udka½G;yguvnf; yGifhvmrnfjzpfonf/
yHk(28)/
uGefysLwmvufpJG 16

yHk(28)

31/ þuJhodkY zdkifzGifhvdkufaomtcg wcgw&H Project File rawGU½Sdygu Menu


Bar ½Sd View udka½G;yg/ 4if;rS Pulldown Menu wpfckjzpfaom Project Explorer udk
a½G;yg/ odrYk [kwf Short Cut Key jzpfonfh Ctrl+R udEk ydS yf g/ yH(k 29)/
17 Microsoft Visual Basic 6.0

yHk(29)

32/ xdt
k cg yH(k 30)wGiaf zmfjyxm;onft h wdik ;f extest001 Dialog Box ay:vmay
rnf/ , wdkYudk toHk;jyKí Project File udkjyefvnfjyKjyif
odrf;Edkifayonf/

yHk(30)
uGefysLwmvufpJG 18

Factorial ½Smonfh y½dk*&rfa&;jcif;


33/ atmufygyHk(31)ygtwdkif; Visual Basic wGizf efw;D xm;&rnf/

yHk(31)

34/ Title Bar wGif ½kyfyHkESifhwuG Factorial pmom;xnfo


h iG ;f &mwGif Properties
ü Form1 Form udka½G;yg/ xdkYaemufatmufygwdkYudkjyifqif&ef/ yHk(32)/

yHk(32)
19 Microsoft Visual Basic 6.0

35/ Caption udk Factorial ESifh Icon udk C:\Program Files\Microsoft Visual
Studio\Common\ Graphics\Icon\Misc xJro S ifah wmf&m½kyyf u
kH akd ½G;xnfjh cif;jzpfonf/
36/ Run ESifh Exit onf Command Button rsm;jzpfMuNyD; 4if;wdkY\oufqdkif&m
Properties rsm;udkvnf; atmufygtwdkif;pDrHxm;&rnf? Run Command Button wGif-
(u) Caption - &Run
( c) Font - MS Sans Serif, Font Style→ → Bold, Font Size → 10

37/ Exit Command Button wGif -


(u) Caption - E&xit
→ Bold, Font Size → 10
( c) Font - MS Sans Serif, Font Style→
38/ Exit Command Button wGifatmufyg Program udka&;om;&ef-
Private Sub Command2_Click()
Unload Me
End
End Sub

39/ Run Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command1_Click()
' Write a program to find the factorial of a given integer:
N! = 1*2*3*4*5*...*N
Cls
a = Text1
kount = 1: k = 1
Do While k < a + 1
kount = kount * k
k = k +1
loop
print "Requirement Answer = = = > ", kount
Text2 = kount
End Sub
uGefysLwmvufpJG 20

40/ Factorial Program udka&;om;&mwGif Do ... Loop a&;xHk;udk odoifhonf/


Do ... Loop a&;xHk;rSm atmufygtwdkif;jzpfonf/
Syntax;
Do [{While/Until} condition]
[Statements]
[Exit Do]
[Statements]
Loop
(or)
Do
[Statements]
[Exit Do]
[Statements]
Loop [{While/Until] condition]
Syntax;
Cls ' Clear form background

41/ xyfcg xyfcgtvkyv f yk &f rnfu h pd rö sm;wGif txufyg Do ... Loop a&;xHk;udk
toH;k jyKonf/ xdt k cg Text1 Text Box xJwGif Cursor 0ifaernfjzpfNyD; 4if;wGif*Pef;
wpfckck ½dkufxnfh&rnf/ Oyrm-4 [k½dkufNyD; Run Command Button udk Click vkyyf gu
Private Sub Command1_Click() ESifh End Sub Mum;½Sd Command rsm;udw k pfaMumif;
csi;f tvkyvf yk o
f mG ;rnf/ Cls a&;xH;k rSm Form ay:wGit f jcm;udprö sm;a&;xm;ygu ½Si;f vif;
ypf&efjzpfygonf/ a = Text1 rSm a xJwGif 4 a&muf½Sdvmrnf/ kount = 1 rSm kount xJ
wGif 1 a&muf½Sdvmrnf/ k = 1 rSm k xJwiG f 1 udx k nfx h m;rnf/ Do While k<a+1 rSm
,cktcsdefwGif k \wefzdk;rSm 1 jzpfaernf/ a \wefzdk;rSm 4 jzpfaeNyD; 1 jzifhaygif;ygu
5 jzpfrnf/ 1 onf 5 xufi,faeojzifh qufvkyf&efjzpfonf/ xdkYaMumifh k wefzdk;onf
5 xufi,faeoa½GUqufvkyfrnfudkajymjcif;jzpfonf/ k = kount * k rSm kount \
wefzdk;rSm 1? k \wefzdk;rSm 1? 4if;ESpfckajr§mufygu 1 om&rnf/ Left Hand Side jzpf
aom kount xJwGif 1 a&muf½SdoGm;rnf/ atmufwpfaMumif;qif;vmygu k \wefzdk;
rSm 1? 1 jzifh aygif;aomaMumifh 2 &rnf/ 4if;wefzdk;udk Left Hand Side jzpfaom k xJ
wGif 2 a&muf½o dS mG ;rnf/ atmufwpfaMumif;jzpfaom Loop odq Yk ufrqif;bJ Do While
k<a+1 odkYjyefwufNyD; Condition udp k pd pfrnf/ k \wefzdk;rSm ,cktcg 2 jzpfaernf/ 2
21 Microsoft Visual Basic 6.0

onf 5 xufi,faeojzifhatmufwpfaMumif;jzpfaom kount = kount * k odkY qif;vm


rnf/ kount \wefzdk;onf 1 jzpfNyD; k wefzdk;rSm 2 jzpfaomaMumifh 2 ESifh 1 ajr§mufygu
2 &rnf/ 4if;wefzdk; kount xJa&mufoGm;rnf/ atmufwpfaMumif;qif;ygu k = k +1
jzpfomG ;ayrnf/ xH;k pHtwdik ;f Do While k<a+1 odkYjyefwufNyD; Condition udpk pd pfayrnf/
k \wefzdk;rSm ,cktcg 3 jzpfaernf/ 3 onf 5 xufi,faeojzifh atmufwpfaMumif;
jzpfaom kount = kount * k odq Yk if;vmrnf/ kount \wefz;kd onf 2 jzpfNy;D k \wefz;kd rSm
3 jzpfvmaomaMumifh 2 ESihf 3 ajrm§ ufygu 6 &rnf/ 4if;wefz;kd tm; kount xJa&mufomG ;
rnf/ atmufwpfaMumif;qufqif;ygu k = k + 1 udk awGUrnf/ k \wefzdk;rSm 3 jzpfí
3 ESihf 1 udak ygif;ygu 4 &rnf/ k \wefzdk;rSm 4 jzpfoGm;ayrnf/ xHk;pHtwdkif; Do
While k<a+1 odkYjyefwufNyD; Condition udp k pd pfrnf/ k \wefzdk;rSm ,cktcg 4 jzpfae
rnf/ 4 onf 5 xufi,faeojzifh atmufwpfaMumif;jzpfaMumif; kount = kount * k
odqYk if;vmrnf/ kount \wefzdk;onf 6 jzpfNyD; k \wefzdk;rSm 4 jzpfaomaMumifh 6 ESifh
4 ajr§mufygu 24 &rnf/ 4if;wefzdk; kount xJa&mufoGm;rnf/ atmufwpfaMumif;quf
qif;ygu k = k + 1 udkawGUrnf/ k \wefzdk;rSm 4 jzpfí 4 ESifh 1 udkaygif;ygu 5 &rnf/
k \wefzdk;rSm 5 jzpfoGm;ayrnf/ xHk;pHtwdkif; Do While k<a+1 odkYjyefwufNyD; Con-
dition udp k pd pfrnf/ k \wefzdk;rSm ,cktcg 5 jzpfaernf/ 5 onf 5 xufi,faeojzifh
Condition rSm;oGm;ayrnf/ xdt k cg Do While ... Loop \ atmufwpfaMumif;jzpfaom
Print "Requirement Answer = = = > ", kount odkY qif;vmayrnf/ Form \
b,fbufaxmifhwGif "Requirement Answer = = = > pmom;ay:vmNyD; 24 [k
azmfjyrnf/ Text2 xJwGifvnf; tajzjzpfaom 24 udkazmfjyaernfjzpfonf/
42/ 2 jzifph m;u 1 <uif;rnf/ 3 jzifph m;ygu 2 <uif;rnf/ 5 jzifph m;ygu 4 <uif;
rnf/ 7 jzifph m;ygu 6 <uif;rnf/ 4if;ude;f wefz;kd ud½k mS &ef/ 4if;ykpmä udw
k u
G cf su&f ef atmuf
azmfjyyg yHk(33)ygtwdkif; Visual Basic wGizf efw;D xm;yg&ef/

yHk(33)
uGefysLwmvufpJG 22

43/ Exit Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command2_Click()
Unload Me
End
End Sub

44/ Run Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command1_Click()
a = 1: Check = True
Do ' While Check = True
If a Mod 2 = 1 And a Mod 3 = 2 And a Mod 5 = 4
And a Mod 7 = 6 Then
Exit Do ' Exit Inner Loop
Else
a=a+1
End If
Loop Until Check = False 'Exit Outer Loop Immediately
Print "Requirement Answer = > ", a
Text1 = a
End Sub

45/ txufyg Program udk Run ygu tajzonf 209 &rnf/ 4if; Program
udka&;&mwGif Mod (Modulus) Operator a&;xHk;udk odoifhonf/
Syntax;
result = number1 Mod number2
A = 7 Mod 4, A → 3
A = 7 Mod 3, A → 1
23 Microsoft Visual Basic 6.0

Prime Number udk½Smjcif;


46/ atmufygyHk(34)ygtwdkif; Visual Basic wGifzefwD;xm;&rnf -

yHk(34)

47/ Exit Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command2_Click()
Unload Me
End
End Sub

48/ Run Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command1_Click()
'To determine whether the given number is Prime Number
Cls
mp = Text1
mc = 2
Do While Not (mp Mod mc = 0 And mc <= mp)
mc = mc + 1
Loop
Print: Print
Print "MP ", mp
Print "MC ", mc
If Text1 = mc Then
Print
Print mp, " is a Prime Number."
Else
Print
Print mp, " does not Prime Number."
End If
End Sub
uGefysLwmvufpJG 24

49/ tu,fírdrpd w
d Bf uKu
d *f Pef;ud½k u
kd o
f iG ;f Ny;D 2 ESihf rdr½d u
kd o
f iG ;f onfh *Pef;Mum;
Prime Number ta&twGufudk½Smvdkygu yHk(35)ygtwdkif; zefwD;wnfaqmuf&ef -

yHk(35)

50/ Exit Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command2_Click()
Unload Me
End
End Sub

51/ Run Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command1_Click()
Cls
d=1
pp = 2
zz = Val(Text1)
Do While pp < zz
mc = 2
Do While Not (pp Mod mc = 0 And mc <= pp)
mc = mc + 1
Loop
If mc = pp Then
d=d+1
Print mc;
End If
pp = pp + 1
Loop
Text2 = d - 1
End Sub
---------------0-0-0---------------
25 Microsoft Visual Basic 6.0

Chapter (2)

Menu wnfaqmufjcif;
1/ Menu wnfaqmuf&mwGif Menu Bar rS Tools Menu udka½G;yg/ xdkYaemuf
Pulldown Menu xJrS Menu Editor ... udka½G;yg/ yHk(36)/ xdktcg Menu Editor
Dialog Box wpfckay:vmrnf/ yHk(37)/

yHk(36)

yHk(37)

2/ Caption nmzuf½dS Box wGif &Options [ka&;&ef/ Name nmzuf½dS Box


wGif Options [ktrnfowfrwS &f ef/ xdt
k cg atmufzuf½dS List Box wGif yH(k 38)ygtwdik ;f
jzpfay:vmrnf/
uGefysLwmvufpJG 26

yHk(38)

3/ txufygyH(k 38)wGif OK udk Mouse Left Click vkyyf gu yH(k 39)ygtwdik ;f jzpf
ay:vmrnf/ 4if;onf Menu Bar jzpfonf/

yHk(39)
27 Microsoft Visual Basic 6.0

4/ xdkYaemuf Pulldown Menu rsm;udkqufvufzefwD;&rnf/ Menu Bar rS


Tools Menu udkjyefa½G;yg/ xdkYaemuf Pulldown Menu xJrS Menu Editor ... uda k ½G;yg/
xdtk cg Menu Editor Dialog Box jyefvnfay:vmrnf/ Command Button wpfcjk zpf
aom udak ½G;yg/ xdaYk emuf Caption List Box ü &Test Buttons udjk znfph u G f
yg/ Name List Box ü TestButtons udjk znfph u G Nf y;D udak ½G;yg/ TestButtons udkuyfí
a&;&rnf/ Test ESifh Buttons udck gG íra&;&yg/ yH(k 40) wGiaf zmfjyxm;onft h wdik ;f jzpfvm
ygu OK udk Click vkyyf g/

yHk(40)

5/ xdktcg yHk(41)wGifazmfjyxm;ouJhodkY Test Buttons onf Pulldown Menu


(or) Dropdown Menu wpfcjk zpfvmrnf/
uGefysLwmvufpJG 28

yHk(41)

6/ txuf y genf ; twd k i f ; Caption List Box wG i f &Word Warp and


Autosize, &Check Box, &Number System, &List Box wdkYESifh Name List Box
wGif WordWrapandAutosize, CheckBox, NumberSystem, ListBox wdu Yk jkd znfph u
G f
NyD; OK udk Left Click vkyfygu yHk(42)wGifjrif&onfhtwdkif; Pulldown Menu (or)
Dropdown Menu rsm;toD;oD;jzpfvmrnf/

yHk(42)
29 Microsoft Visual Basic 6.0

7/ Pulldown Menu wpfckjzpfaom List Box udk Mouse Left Click ESy d yf gu
aemufxyf Sub-Menu wpfckay:xGufapvdkygu Menu Editor ... udkjyefac:í
udka½G;yg/ xdkYaemuf udak ½G;yg/ Caption List Box wGif N&umber,,
T&ext wdkYESifh Number List Box wGif Number, Text wdkYudkjznfhpGufNyD; OK udk Mouse
Left Click vkyfygu yHk(43)wGif jrif&onfhtwdkif; Pulldown Menu (or) Dropdown
Menu rsm; toD;oD;jzpfvmrnf/

yHk(43)

8/ tqdkyg Pulldown Menu wpfckjzpfaom List Box onf Word Wrap


and Autosize ESifh Check Box Mum;wGif ae&mjyefvnfajymif;a½TUvdkygu Menu Bar
½Sd Tools udak ½G;yg/ Dropdown Menu wpfcjk zpfaom Menu Editor ... udjk yefvnfa½G;yg/
...&Check Box uda k ½G;í Dropdown Arrow jzifah tmufq;kH udk a&mufatmifa½TU&ef/
xdkenf;wl ...&Number System udkvnf; atmufqHk;odkYa&mufatmifa½TUNyD; OK udk
Click vkyjf cif;jzifh &½SE
d ikd af yonf/ yH(k 44)? xdt
k cg yH(k 45)ygtwdik ;f Menu ajymif;vJomG ;ay
rnf/
uGefysLwmvufpJG 30

yHk(44)

yHk(45)

9/ Form1 Menu xJrSxGuf&ef Command Button jzifh Exit udkzefwD;í xHk;pH


twdkif; y½dk*&rfa&;om;&rnf/ yHk(46)/
Private Sub Command1_Click()
Unload Me
End
End Sub
31 Microsoft Visual Basic 6.0

yHk(46)

Pulldown Menu wpfcjk zpfaom Test Buttons uda


k ½G;ygujzpfvmrnfh Program udk
a&;om;jcif;
10/ Pulldown Menu wpfcjk zpfaom Test Buttons uda k ½G;ygu 4if;ESiv
hf u
kd af vsm
nDaxGjzpfap&ef Form wpfck Insert jyKvyk í
f vdtk yfaomy½d*k &rfrsm;a&;om;&rnf/ Form
wpfckudk Insert jyKvyk v
f ykd gu Menu Bar ½Sd Project udka½G;yg/ xdkYaemuf Pulldown
Menu jzpfaom Add Form udk a½G;&efjzpfonf/ yHk(47)/

yHk(47)
uGefysLwmvufpJG 32

11/ Form2 jzpfay:vmygu yHk(48)ygtwdkif;wnfaqmuf&efjzpfonf/

yHk(48)

12/ Command Button wpfckjzpfaom ChangeSignal wGif atmufygy½dk*&rfudk


a&;om;&rnf-
Private Sub Command1_Click()
ChangeSignal
End Sub

13/ Command Button aemufwpfckjzpfaom Close wGif atmufygy½dk*&rfudk


a&;om;&rnf-
Private Sub Command2_Click()
Form2.Hide
Form1.Show
End Sub

14/ Command1 wGifa&;om;xm;aomy½dk*&rfrSm wdkuf½dkuf Run aomy½dk*&rf


jzpfojzifh 4if;y½dk*&rfudk qufvufa&;om;&ef vdktyfygonf/ yHk(49)/
15/ Pulldown Menu wpfckjzpfaom Test Button udk Click vkyy
f g/ 4if;wGif
Form2 udk vSrf;íac:aom y½dk*&rfudka&;om;&rnf/
Private Sub TestButtons_Click()
Form2.Show
End Sub
33 Microsoft Visual Basic 6.0

16/ Form2 \ General wGifatmufygy½dk*&rfudk xyfrHa&;om;&rnf -

yHk(49)

Word Wrap and Autosize (Pulldown Menu) twGuf Program a&;om;jcif;


17/ Pulldown Menu wpfckjzpfaom Word Wrap and Autosize Button udka½G;
ygu 4if;ESifhvdkufavsmnDaxGjzpfap&ef aemufxyf Form wpfckzefwD;í vdktyfaom
y½dk*&rfrsm;a&;om;&rnf/ yHk(50)/

yHk(50)

18/ Form3 udkatmufygtwdkif;wnfaqmuf&rnf? yHk(51)/

yHk(51)
uGefysLwmvufpJG 34

19/ yH(k 51)yg Form wGif , ESifh wdkY


udo
k ;kH xm;ygonf/ Check1 wGif Auto Size ESifh Check2 wGif Word Wrap wdkYudk
owfrSwfxm;ygonf/ 4if;wdkYudk atmufygtwdkif; y½dk*&rfrsm;a&;om;&rnf-
Private Sub Check1_Click()
If Check1.Value = 1 Then
Label1.AutoSize = True
Else
Label1.AutoSize = False
Label1.Height = 300
Label1.Width = 2000
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
Label1.WordWrap = True
Label1.AutoSize = True
Else
Label1.WordWrap = False
Label1.Height = 300
Label1.Width = 2000
End If
End Sub
Private Sub Command1_Click()
Form3.Hide
Form1.Show
End Sub

List Box (Pulldown Menu) twGuf Program a&;om;jcif;


20/ List Box udka½G;vdkufygu Sub-Menu wpfckxyfrHay:vmrnf/ 4if;wdkYrSm
Number, Text wdjYk zpfMuonf/ Number udka½G;ygu Number ESifhywfoufaom Form
wpfckay:&efESifh vdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(52)/
35 Microsoft Visual Basic 6.0

yHk(52)

21/ tqdyk g Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf atmufygtwdkif;


jyifqif&rnf/

yHk(53)

22/ txufygyHk(53)udkzefwD;&mwGif , , ESifh


wdu
Yk o
kd ;kH xm;ygonf/ txufyg Form yHpk t
H m; Run í&Edkifap&ef
vdktyfaomy½dk*&rfrsm;udk a&;om;&rnf/
23/ Add Command Button wGifatmufyg Program udka&;om;&ef-
Private Sub Command1_Click()
List1.AddItem Text1.Text
Text1.Text = ""
Text1.SetFocus
uGefysLwmvufpJG 36
Label3.Caption=List1.ListCount
End Sub

24/ Remove Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command2_Click()
Dim Ind As Integer
Ind = List1.ListIndex
If Ind >= 0 Then
List1.RemoveItem Ind
Label3.Caption = List1.ListCount
Else
Beep
End If
Command2.Enabled = (List1.ListIndex <> -1)
End Sub

25/ Clear Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command3_Click()
List1.Clear
Command2.Enabled = False
Label3.Caption = List1.ListCount
End Sub

26/ Close Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command4_Click()
Unload Me
End Sub

27/ List Box (Single Click) twGufatmufyg Program udka&;om;&ef-


Private Sub List1_Click()
Command2.Enabled = (List1.ListIndex <> -1)
End Sub

28/ List Box (Double Click) twGufatmufyg Program udka&;om;&ef-


Private Sub List1_DblClick()
Command2.Value = True
End Sub
37 Microsoft Visual Basic 6.0

29/ Text1, Add Command Button wdt


Yk wGuaf tmufyg Program udak &;om;
&ef-
Private Sub Text1_Change()
Command1.Enabled = (Len(Text1.Text)>0)
End Sub

30/ Text udka½G;ygu Text ESifhywfoufaom Form wpfckay:&ef Form wpfckudk


zefwD;ívdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(54)/

yHk(54)

31/ tqdyk g Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf atmufygtwdkif;


jyifqif&rnf/ yH(k 55)/

yHk(55)

32/ txufygyHk(55)udkzefwD;&mwGif , , ESifh


wduYk o
kd ;kH xm;ygonf/ txufyg Form yHkpHwGiftpDtpOfrsm;udk Run
Edkif&eftwGuf vdktyfaomy½dk*&rfrsm;udk a&;om;&rnf/
uGefysLwmvufpJG 38

33/ Add Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command1_Click()
List1.AddItem Text1.Text
Text1.Text = ""
Text1.SetFocus
Label3.Caption=List1.ListCount
End Sub

34/ Remove Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command2_Click()
Dim Ind As Integer
Ind = List1.ListIndex
If Ind >= 0 Then
List1.RemoveItem Ind
Label3.Caption = List1.ListCount
Else
Beep
End If
Command2.Enabled = (List1.ListIndex <> -1)
End Sub

35/ Clear Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command3_Click()
List1.Clear
Command2.Enabled = False
Label3.Caption = List1.ListCount
End Sub

36/ Close Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command4_Click()
Unload Me
End Sub

37/ List Box (Single Click) twGuf


Private Sub List1_Click()
Command2.Enabled = (List1.ListIndex <> -1)
End Sub
39 Microsoft Visual Basic 6.0

38/ List Box (Double Click) twGuf


Private Sub List1_DblClick()
Command2.Value = True
End Sub

39/ Text1, Add Command Button wdkYtwGuf


Private Sub Text1_Change()
Command1.Enabled = (Len(Text1.Text)>0)
End Sub

40/ Check Box (Pulldown Menu) twGuf Program a&;om;jcif;


Pulldown Menu wpfcjk zpfaom Check Box udak ½G;ygu 4if;ESiv
hf u
kd af vsmnD
axGjzpfap&ef aemufxyf Form wpfckzefwD;í vdktyfaomy½dk*&rf rsm;a&;om;&rnf/
yHk(56)/

yHk(56)

41/ tqdyk g Form yHkpHwGif tpDtpOfrsm;udk Run Edik &f ef twGuf wpfzufygtwdik ;f
jyifqif&rnf/ yH(k 57)/ , , ESifh
wdkYudkoHk;xm;ygonf/
uGefysLwmvufpJG 40

yHk(57)

42/ txufyg yH(k 57)tm; Run í &Edkifap&ef vdktyfaomy½dk*&rfrsm;udka&;om;&


rnf/
43/ Check1 wGifatmufyg Program udka&;om;&ef-
Private Sub Check1_Click()
Dim a1 As Font
Set a1 = Text1.Font
If Check1.Value = 1 Then
a1.Bold = True
Else
a1.Bold = False
End If
End Sub

44/ Check2 wGifatmufyg Program udka&;om;&ef-


Private Sub Check2_Click()
Dim a1 As Font
Set a1 = Text1.Font
If Check2.Value = 1 Then
a1.Italic = True
41 Microsoft Visual Basic 6.0

Else
a1.Italic = False
End If
End Sub

45/ Check3 wGifatmufyg Program udka&;om;&ef-


Private Sub Check3_Click()
Dim a1 As Font
Set a1 = Text1.Font
If Check3.Value = 1 Then
a1.Underline = True
Else
a1.Underline = False
End If
End Sub

46/ Check4 wGifatmufyg Program udka&;om;&ef-


Private Sub Check4_Click()
Dim a1 As Font
Set a1 = Text1.Font
If Check4.Value = 1 Then
a1.Strikethrough = True
Else
a1.Strikethrough = False
End If
End Sub

47/ Close Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command1_Click()
Unload Me
End Sub
uGefysLwmvufpJG 42

Number System (Pulldown Menu) twGuf Program a&;om;jcif;


48/ Pulldown Menu wpfckjzpfaom Number udka½G;ygu 4if;ESifhvdkufavsmnD
axGjzpfap&ef aemufxyf Form wpfckzefwD;í vdktyfaomy½dk*&rfrsm;a&;om;&rnf/
yHk(58)/

yHk(58)

49/ tqdyk g Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf atmufygtwdkif;


jyifqif&rnf/ yH(k 59)/

yHk(59)

50/ txufyg , , ESifh


wdu
Yk o
kd ;kH xm;ygonf/ 4if; Form yHkpHwGif Run í&Edkifap&ef vdktyfaomy½dk*&rfrsm;udk
a&;om;&rnf/
51/ General, Declarations wGifatmufyg Program udka&;om;&ef-
Dim a As Integer
43 Microsoft Visual Basic 6.0

52/ Close Command Button wGifatmufyg Program udka&;om;&ef-


Private Sub Command1_Click()
Unload Me
End Sub

53/ Option1 wGifatmufyg Program udka&;om;&ef-


Private Sub Option1_Click()
Label2.Caption = Format(a)
End Sub

54/ Option2 wGifatmufyg Program udka&;om;&ef-


Private Sub Option2_Click()
Label3.Caption = Oct(a)
End Sub

55/ Option3 wGifatmufyg Program udka&;om;&ef-


Private Sub Option3_Click()
Label4.Caption = Hex(a)
End Sub

56/ Text1 wGifatmufyg Program udka&;om;&ef-


Private Sub Text1_Change()
a = Val(Text1.Text)
End Sub

57/ Options Menu wGif xyfrHí Multiple Column List Box, Scroll Bars,
Control Array wdu
Yk zkd efw;D &ef/ yH(k 60)/

yHk(60)
uGefysLwmvufpJG 44

Multiple Column List Box (Pulldown Menu) twGuf Program a&;om;jcif;


58/ Pulldown Menu wpfckjzpfaom Multiple Column List Box udka½G;ygu
4if;ESiv
hf u
kd af vsmnDaxGjzpfap&ef aemufxyf Form wpfczk efw;D í vdt
k yfaomy½d*k &rfrsm;
a&;om;&rnf/ yHk(61)/

yHk(61)

59/ tqdyk g Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf atmufygwdkif;


jyifqif&rnf/yHk(62)/

yHk(62)

60/ tqdkygyHk(62)udk zefwD;&mwGif ESifh wdkYudk


oHk;xm;ygonf/
61/ List1 List Box \ Properties wGif atmufygwdkYudkjyifqifxm;½Sd&rnf -
(u) Columns - 2
( c) MultiSelect - 2 - Extended
45 Microsoft Visual Basic 6.0

62/ yH(k 62)yg Form yHpk t


H m; Run í&Edkifap&ef atmufygy½dk*&rfrsm;udka&;om;
&rnf/
63/ Transfer Command Button twGuf-
Private Sub Command1_Click()
For n = 0 To (List1.ListCount - 1)
If List1.Selected(n) = True Then ' If selected then add to the bottom
list.
List2.AddItem List1.List(n)
End If
Next
Command2.Enabled = True
'An item is now in the bottom list, so enable the clear button.
End Sub

64/ Clear Command Button twGuf-


Private Sub Command2_Click()
List2.Clear
Command2.Enabled = False
End Sub

65/ Close Command Button twGuf-


Private Sub Command3_Click()
Unload Me
End Sub

66/ Form Load twGuf-


Private Sub Form_Load()
'Note that the Sorted property of list is True, so adding
'items in alphabetical order is not actually necessary.
List1.AddItem "Yangon"
List1.AddItem "Myeik"
List1.AddItem "Bagan"
List1.AddItem "Kalaw"
List1.AddItem "Meiktila"
List1.AddItem "North Okkalapa"
List1.AddItem "Mingaladon"
uGefysLwmvufpJG 46
List1.AddItem "South Okkalapa"
List1.AddItem "North Dagon"
List1.AddItem "South Dagon"
List1.Selected(1) = True
End Sub

67/ List1 List Box Double Click twGuf-


Private Sub List1_DblClick()
Command1.Value = True 'A user clicked the Transfer button.
End Sub

Scroll Bars toHk;jyKrItwGuf Program a&;om;jcif;


68/ Pulldown Menu wpfcjk zpfaom Scroll Bars udak ½G;ygu 4if;ESiv
hf u
kd af vsmnD
axGjzpfap&ef Form wpfckzefwD;í vdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(63)/

yHk(63)

69/ tqdyk g Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf yHk(64)ygtwdkif;


jyifqif&rnf/ , , ESifh wdkYudkoHk;
xm;ygonf/

yHk(64)
47 Microsoft Visual Basic 6.0

70/ Function wpfckjzpfaom DoColor twGuf yHk(65)wGifazmfjyxm;ygonf/

yHk(65)

71/ Close Command Button twGuf-


Private Sub Command1_Click()
Unload Me
End Sub

72/ Red Horizontal Scroll Bar twGuf-


Private Sub HScroll1_Change()
HScroll1_Scroll 'Call the event procedure directly.
End Sub
Private Sub HScroll1_Scroll()
DoColor
End Sub

73/ Green Horizontal Scroll Bar twGuf-


Private Sub HScroll2_Change()
HScroll2_Scroll 'Call the event procedure directly.
End Sub
Private Sub HScroll2_Scroll()
DoColor
End Sub
uGefysLwmvufpJG 48

74/ Blue Horizontal Scroll Bar twGuf-


Private Sub HScroll3_Change()
HScroll3_Scroll 'Call the event procedure directly.
End Sub
Private Sub HScroll3_Scroll()
DoColor
End Sub

Menu Bar aemufwpfckxyfrHjyKvkyfjcif;


75/ yHk(66)ygyHkwGif Menu wpfckom½SdNyD; Menu rSxGufcGgvdkygu Command
Button wpfcu k tkd oH;k jyKí xdk Command Button udk Click jyKvyk jf cif;jzifh xGucf gG Edik af y
onf/ þuJo h Ykd Menu rSxu G cf gG vdo
k nfh aemufxyf Menu Bar wpfcw k nfaqmufvykd gu
Tools udka½G;yg/ xdkYaemuf Pulldown Menu wpfckjzpfaom Menu Editor ... uda k ½G;yg/

yHk(66)

76/ xdt k cg yH(k 67)ygtwdik ;f Menu Editor ay:vmrnf/ 4if; ...&Scroll Bars
wGif Active jzpfatmifxm;í Next Command Button udka½G;yg/ xdkYaemuf Caption
wGif E&xit, Name wGif Exit [kjznfhpGufí Left Arrow Button tm;a½G;ygu
...E&xit onf E&xit jzpfoGm;ayrnf/ a½SUqHk;rSOD;aqmifonfh ... aysmufoGm;ayrnf/
xdkYaemuf Exit \atmufwGif½Sdaom Pulldown Menu rsm;tm; qufvufzefwD;&ef
jzpfonf/ yHk(67)? yHk(68)/
49 Microsoft Visual Basic 6.0

yHk(67)

yHk(68)
uGefysLwmvufpJG 50

77/ xdt
k cg yH(k 69)ygtwdik ;f Menu rsm;ajymif;vJoGm;ayrnf/ Exit Command
Button tm;zsuy
f pf&rnf/

yHk(69)

78/ txufygyHk(69)yg Pulldown Menu wpfckjzpfaom Quit tm; Double


Click ESdyfívdktyfaomy½dk*&rftm;a&;om;&rnf/

79/ Pulldown Menu wpfckjzpfaom Quit twGuf-


Private Sub Quit_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
80/ txufyg y½d*k &rfrsm;udak &;&eftwGuf atmufyga&;xH;k rsm;udk od½&dS efvt
kd yfyg
onf-
Syntax;
Val(<String>)
String wpfcktm; wGufcsufí&aom wefzdk;wpfcktjzpf ajymif;vJay;onf/
Oyrm -
MyValue = Val("2457") ' Returns 2457
MyValue = Val(" 2 45 7") ' Returns 2457
MyValue = Val("24 and 57") ' Returns 24

Syntax;
If <Condition> Then <Statements>
[Else <Statements>]
End If
51 Microsoft Visual Basic 6.0

(Or)
If <Condition> Then
[<Statements>]
ElseIf <Conditon-n> Then
[<Statements>]] ...
[Else
<Statements>]]
End If
Oyrm -
Number = 53 'Initialize Variable
If Number < 10 Then
Digits = 1
ElseIf Number < 100 Then
'Condition evaluates to True so the next statement is executed.
Digits = 2
Else
Digits = 3
End If
Syntax;
<Object>.AddItem item, index
<Object>.Clear
<Object>.RemoveItem index
Oyrm -
Private Sub Form_Click()
Dim Entry, I, Msg 'Declare variables.
Msg = "Choose OK to add 100 items to your list box."
MsgBox Msg 'Display message.
For I = 1 To 100 'Count from 1 to 100.
Entry = "Entry " & I 'Create entry.
List1.AddItem Entry 'Add the entry.
Next I
Msg = "Choose OK to remove every other entry."
MsgBox Msg 'Display message.
For I = 1 To 50 'Determine how to
uGefysLwmvufpJG 52
List1.RemoveItem I 'Remove every other
Next I 'Item.
Msg = "Choose OK to remove all items from the list box."
MsgBox Msg 'Display message.
List1.Clear 'Clear list box.
End Sub
Syntax;
<Object>.Bold [=boolean]
<Object>.Italic [=boolean]
<Object>.Underline [=boolean]
<Object>.Strikethrough [=boolean]
Oyrm -
Private Sub Form_Click()
Font.Bold = Not Font.Bold 'Toggle bold.
Font.StrikeThrough = Not Font.StrikeThrough 'Toggle Strikethrough
Font.Italic = Not Font.Italic 'Toggle italic
Font.Underline = Not Font.Underline 'Toggle underline
Font.Size = 16 'Set size property
If Font.Bold then
Print "Font weight is " & Font.Weight & " (bold)."
Else
Print "Font weight is " & Font.Weight & " (not bold)."
End If
End If
Syntax;
Oct(<Number>)
Oyrm -
MyOct = Oct(4) 'Returns 4
MyOct = Oct(8) 'Returns 10
MyOct = Oct(459) 'Returns 713
Syntax;
Hex(<Number>)
53 Microsoft Visual Basic 6.0

Oyrm -
MyHex = Hex(5) 'Returns 5
MyHex = Oct(8) 'Returns A
MyHex = Oct(459) 'Returns 1CB
Syntax;
Format(expression[,format[,firstdayofweek [,firstweekofyear]]])
Oyrm -
MyTime = #17:04:23#
MyDate = #January 27, 1993#
'Returns current system time in the system-defined long time format.
MyStr = Format(Time, "Long Time")
MyStr = Format(MyTime, "h:m:s") 'Returns "17:4:23"
MyStr = Format(MyTime, "hh:mm:ss AMPM")
'Returns "05:04:23 PM"
MyStr = Format(MyDate, "dddd, mmm d yyyy")
'Returns "Wednesday, Jan 27 1993"
'If format is not supplied, a string is returned.
MyStr = Format(23) 'Returns "23".
'User-defined formats.
MyStr = Format(5459.4, "##,##0.00") 'Returns "4,459.40".
MyStr = Format(334.9,"###0.00") 'Returns "334.90".
MyStr = Format(5, "0.00%") 'Returns "500.00%".
MyStr = Format("HELLO", "<") 'Returns "hello".
MyStr = Format("This is it", ">") 'Returns "THIS IS IT".
Syntax;
<Object>.BackColor [=color]
<Object>.ForeColor [=color]
Oyrm -
Private Sub Form_Load()
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
BackColor = QBColor(Rnd * 15)
ForeColor = QBColor(Rnd * 10)
uGefysLwmvufpJG 54
Picture1.BackColor = QBColor(Rnd * 15)
Picture1.ForeColor = QBColor(Rnd * 10)
End Sub
Syntax;
RGB(red, green, blue)
Red, Green, Blue wefzdk;rsm;onf 0 ESifh 255 Mum;½SdMuonf/
Oyrm -
Red = RGB(255, 0, 0) 'Return the value for Red.
I = 75 'Initialize offset.
RGBValue = RGB(I, 64 + I, 128 + I)
'Same as RGB(75, 139, 203).
MyObject.Color = RGB(255, 0, 0)
'Set the Color property of MyObject to Red.
Color Red Value Green Value Blue Value
Black 0 0 0
Blue 0 0 255
Green 0 255 0
Cyan 0 255 255
Red 255 0 0
Magenta 255 0 255
Yellow 255 255 0
White 255 255 255
Syntax;
<Object>.ListCount
<Object>.ListIndex [=index]
<Object>Selected(index) [=boolean]
Oyrm(1) -
Dim Player(0 To 2)
Dim Salary(0 To 2)
Private Sub Form_Load()
Dim I 'Declare Variable.
AutoSize = True
Player(0) = "Miggey McMoo" 'Enter data into arrays.
55 Microsoft Visual Basic 6.0

Player(1) = "Alf Hinshaw"


Player(2) = "Woofer Dean"
Salary(0) = "$234,500"
Salary(1) = "$158,900"
Salary(2) = "$1,030,500"
For I = 0 To 2 'Add names to list.
Combo1.AddItem Player(I)
Next I
Combo1.ListIndex = 0 'Display first item in list.
End Sub
Private Sub Combo1_Click()
'Display corresponding salary for name.
Label1.Caption = Salary(Combo1.ListIndex)
End Sub

Oyrm(2) -
Private Sub Form_Load()
Dim I 'Declare Variable.
'Fill the list box with screen font names.
For I = 0 To Screen.FontCount - 1
List1.AddItem Screen.Fonts(I)
Next I
End Sub
Private Sub Command1_Click()
Dim I 'Declare Variable.
'Clear all items from the list.
List2.Clear
'If an item is selected, add it to List2.
For I = 0 To List1.ListCount - 1
If List1.Selected(I) Then
List2.AddItem List1.List(I)
End If
Next I
End Sub
uGefysLwmvufpJG 56
Syntax;
Load <Object>
Unload <Object>
Oyrm -
Private Sub Form_Click()
Dim Answer.Msg 'Declare Variable
Unload Form1
Msg = "Form1 has been unloaded. Choose Yes to load and "
Msg = Msg & "display the form. Choose No to load the form "
Msg = Msg & "and leave it invisible."
Answer = MsgBox(Msg, 4)'Get user response.
If Answer = 6 Then 'Evaluate answer.
Show 'If Yes, show form.
Else
Load Form1 'If No, just load it.
Msg = "Form1is now loaded. Choose OK to display it."
MsgBox Msg 'Display message.
Show 'Show form.
End If
End Sub
Syntax;
<Object>.Hide
<Object>.Show
Oyrm -
Private Sub Form_Click()
Dim Answer.Msg 'Declare Variable
Hide
Msg = "Choose OK to make the form reappear."
MsgBox Msg 'Display message.
Show 'Show form again.
End Sub
57 Microsoft Visual Basic 6.0

Syntax;
<Object>.Enabled [=boolean]
<Object>.Visible [=boolean]
<Object>.SetFocus
Oyrm -
Private Sub Form_Click()
Text1.Text = "" 'Clear the text box.
Command1.Caption = "Save" 'Put caption on button.
End Sub

Private Sub Text1_Change()


If Text1.Text = "" Then 'See if text box is empty.
Command1.Enabled = False 'Disable button.
Else
Command1.Enabled = True 'Enable button.
End If
End Sub

---------------0-0-0---------------
uGefysLwmvufpJG 58

Chapter (3)

Graphic rsm;udk Windows yHkpHtwdkif;½SmazGjcif;


1/ atmufyg yHk(70)ygtwdkif; Visual Basic 6.0 wGizf efw;D &ef/

(1)

(4)
yHk(70)
(2) (6)

(3)

(5)

2/ yH(k 70)yg Form wGi(f 1)udk File List Box jzifzh efw;D xm;Ny;D (2)
tm; Drive List Box jzifzh efw;D xm;ygonf/(3)udk Label
jzifzh efw;D xm;Ny;D (4)tm; Dir List Box jzifzh efw;D xm;onf/(5)udk Com-
mand Button jzifhzefwD;xm;í(6) udk Image jzifzh efw;D xm;
ygonf/
3/ File1 File List Box \ Properties wGif Pattern = *.bmp;*.wmf;*.pic;
*.jpg;*.ico;*.gif [kjyifqifxm;&rnf/

4/ Label1 Label \ Properties wGif Border Style = Fixed Single [kjyifqif


xm;&rnf/
5/ Image1 Image \ Properties wGif atmufygtwdkif;jyifqif&ef-
(u) Border Style = Fixed Single
( c) Stretch = True /
59 Microsoft Visual Basic 6.0

6/ Command1 Command Button \ Properties wGif Caption = E&xit


[kjyifqifxm;&rnf/
7/ tqdyk g Properties rsm;udk jyifqifjznfhpGufNyD;ygu oufqdkif&mtydkif;vdkuf
vdktyfaomy½dk*&rfrsm;a&;om;&efjzpfygonf/
8/ Command Button jzpfaom Exit twGuf -
Private Sub Command1_Click()
Unload Me
End
End Sub

9/ Directory List Box twGuf -


Private Sub Dir1_Change()
File1.Path = Dir1.Path 'Update Files
End Sub

10/ Drive List Box twGuf -


Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive 'Update Directory Path
End Sub

11/ File List Box twGuf (Single Click)


Private Sub File1_Click()
Label1 = File1
End Sub

12/ File List Box twGuf (Double Click)


Private Sub File1_DblClick()
If Right(File1.Path, 1) <> "\" Then
Label1.Caption = File1.Path & "\" & File1.FileName
Else
Label1.Caption = File1.Path & File1.FileName
End If
Form1.Image1.Picture = LoadPicture(Label1.Caption)
End Sub
uGefysLwmvufpJG 60

13/ Form twGuf -


Private Sub Form_Load()
Drive1.Drive = App.Path
Dir1.Path = App.Path
End Sub
---------------0-0-0---------------
14/ wpfzufygy½dk*&rfrsm;udka&;&eftwGuf atmufyga&;xHk;rsm;udk od½Sd&efvdktyf
ygonf-
Syntax;
<Object>.Drive [=drive]
Oyrm -
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive 'When drive changes, set directory path.
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path 'When directory changes, set file path.
End Sub
Syntax;
<Object>.FileName [=pathname]
Oyrm
Private Sub Dir1_Change()
File1.Path = Dir1.Path 'Set File1 path.
End Sub
Private Sub File1_PathChange()
Dir1.Path = File1.Path 'Set Dir1 path.
End Sub
Private Sub File1_DblClick()
'Display the selected filename when double-clicked.
Label1.Caption = "Your selection: " + UCase(File1.FileName)
End Sub
Syntax;
<Object>.Path [=pathname]
61 Microsoft Visual Basic 6.0

Oyrm
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive 'Set directory path.
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Syntax;
LoadPicture([stringexpression])
Oyrm
Private Sub Form_Click()
Dim Msg 'Declare Variables.
On Error Resume Next 'Set up error handling.
Height = 3990: Width = 4890 'Set Height and Width.
Picture = LoadPicture("PAPER.BMP")
If Err Then
Msg = "Couldn't find the .BMP file."
MsgBox Msg 'Display error message.
Exit Sub
End If
Msg = "Choose OK to clear the bitmap from the form."
MsgBox Msg
Picture = LoadPicture() 'Clear form.
End Sub
Syntax;
<Object>.Picture [=picture]
Oyrm
Private Sub Form_Load()
'Load the icons.
Picture1.Picture = LoadPicture("icons\computer\trash02a.ico")
Picture2.Picture = LoadPicture("icons\computer\trash02b.ico")
End Sub
---------------0-0-0---------------
uGefysLwmvufpJG 62

Timer jzifhtcsdefudkazmfjyonfh y½dk*&rfwpfckudkzefwD;jcif;


15/ atmufazmfjyygyHk(71)ygtwdkif; Visual Basic 6.0 wGifzefwD;&rnf-

(1)

yHk(71)
(2)

16/ yH(k 71)yg Form wGif (1)udk jzifhzefwD;xm;NyD;(2)tm;


jzifh zefw;D xm;ygonf/ txufygtwdik ;f jyifqifNy;D ygu oufqikd &f mtydik ;f vdu
k f y½d*k &rf
rsm;a&;om;&efjzpfygonf/
17/ Form qJGwif&mwGiftvkyfvkyf&eftwGuf -
Private Sub Form_Load()
Timer1.Interval = 1000 'Set Time Interval
End Sub

18/ Label1 wGiftcsdefjy&eftwGuf


Private Sub Timer1_Timer()
Label1.Caption = Time 'Update Time Display
End Sub
Syntax;
<Object>.Interval [=milliseconds]
Oyrm
Private Sub Form_Load()
Timer1.Interval = 900 'Set interval.
HScroll1.Min = 100 'Set minimum.
HScroll1.Max = 900 'Set maximum.
End Sub
63 Microsoft Visual Basic 6.0

Private Sub HScroll_Change()


'Set interval according to scroll bar value.
Timer1.Interval = 1000 - HScroll.Value
End Sub
Private Sub Timer1_Timer()
'Switch BackColor between red and blue.
If Picture1.BackColor = RGB(255, 0, 0) Then
Picture1.BackColor = RGB(0, 0, 255)
Else
Picture1.BackColor = RGB(255, 0, 0)
End If
End Sub
Time Function
Syntax;
Time
Oyrm
Mytime = Time 'Return Current System Time
Date Function
Syntax;
Date
Oyrm
MyDate = #February 12, 1985# 'Assign a date
Date = MyDate 'Change System Date.
Syntax;
Now ' Returns the current date and time according.
Oyrm
Today = Now 'Assign current system date and time
Day Function
Syntax;
Day(date)
Oyrm
MyDate = #February 12, 1969# 'Assign a date
MyDay = Day(MyDate) 'MyDay contains → 12
uGefysLwmvufpJG 64
Hour Function
Syntax;
Hour(time)
Oyrm
Mytime = #4:35:17 PM# 'Assign a time
MyHour = Hour(Mytime) 'MyHour contains 16
Minute Function
Syntax;
Minute(time)
Oyrm
Mtime = #4:35:17 PM# 'Assign a time
MyMinute = Minute(Mytime) 'MyMinute contains 85
Month Function
Syntax;
Month(date)
Oyrm
Mydate = #February 12, 1969# 'Assign a date
MyMonth = Month(Mydate) 'MyMonth contains 2
Second Function
Syntax;
Second(time)
Oyrm
Mytime = Time 'Returns current system time
MySecond = Second(Mytime) 'MySecond contains 17
Weekday Function
Syntax;
Weekday(date,[firstday of week])
Oyrm
MyDate = #February 12, 1969# 'Assign a date.
MyWeekDay = Weekday(MyDate) 'MyWeekDay contains 4 because
'MyDate represents a Wednesday.
Year Function
Syntax;
Year(date)
65 Microsoft Visual Basic 6.0

Oyrm
MyDate = #February 12, 1969# 'Assign a date.
MyYear = Year(MyDate) 'MyYear contains 1969.

tcsdefESifhywfoufaom Function rsm;udk Form zefwD;íprf;oyfjcif;


19/ atmufygyHk(72)ygtwdkif; Visual Basic 6.0 wGizf efw;D &ef/

yHk(72)

20/ Run Command Button twGuf -


Private Sub Command1_Click()
Cls
MyDate = Date 'Assign Current System Date
MyDay = Day(MyDate) 'Assign Current System Day
MyTime = Time 'Assign Current System Time
MyHour = Hour(MyTime) 'Assign Current System Hour
MyMinute = Minute(MyTime) 'Assign Current System Minute
MySecond = Second(MyTime)'Assign Current System Second
MyMonth = Month(MyDate) 'Assign Current System Month
MyWeekDay = Weekday(MyDate) 'Assign Current System Day of Week
MyYear = Year(MyDate) 'Assign Current System Year
Today = Now 'Assign Current System Now
Print "To Date ", MyDate
Print "To Day ", MyDay
Print "My Time ", MyTime
uGefysLwmvufpJG 66
Print "My Hour ", MyHour
Print "My Minute ", MyMinute
Print "My Second ", MySecond
Print "My Month ", MyMonth
Print "My Week Day ", MyWeekDay
Print "My Year ", MyYear
Print "Now ", Today
End Sub

21/ txufyg Program udk Run ygu yHk(73)ygtwdkif;azmfjyrnfjzpfonf/

yHk(73)

Random Function
Initializes the random-number generator.
Syntax;
Randomize [number]
The number argument can be any valid numeric expression.
Oyrm
Randomize 'Initialize random-number generator.
MyValue = Int(6 * Rnd) + 1) 'Generate random value between 1 and 6
Syntax;
Rnd [(number)]
Returns a random number. The number argument can be any valid nu-
meric expression.
Move Method
Syntax;
<Object>.Move left, top, width, height
<Object>.Left [=value]
<Object>.Top [=value]
67 Microsoft Visual Basic 6.0

22/ atmufyg yHk(74)tm; Move Sample Title Bar jzifhzefwD;xm;&ef -

yHk(74)

txufygyHk(74)wGif Image, Timer,, Command Button wdkY


yg0ifMuonf/ Timer Properties wGif Interval tm; 100 [kxm;yg/ Command
Button wGifvdktyfaomy½dk*&rfrsm;udka&;om;&rnf/

23/ Exit Command Button twGuf-


Private Sub Command1_Click()
Unload Me
End
End Sub

24/ Timer1_Timer twGuf-


Private Sub Timer1_Timer()
a = Image1.Left
b = Image1.Top
Image1.Move a + 50, b + 33
End Sub

25/ wpfzufyg yH(k 75)tm; Move Method Example Title Bar jzifhzefwD;xm;&
rnf/
uGefysLwmvufpJG 68

yHk(75)

26/ txufygyHk(75)wGif Image, Command Button wdy


Yk g0ifMuonf/
Form1 Form Properties wGif Windows State tm; 2 - Maximized [kxm;yg/
Command Button wGif vdktyfaomy½dk*&rfrsm;udka&;om;&rnf/
27/ Run Command Button twGuf -
Private Sub Command1_Click()
For j = 1 To 10
Image1.Left = 0
Image1.Top = 0
i = Image1.Left
k = Image1.Top
For i = 0 To 11500
Image1.Move i, k
Next
Image1.Left = 11500
Image1.Top = 0
i = Image1.Left
k = Image1.Top
For k = 0 To 7700
Image1.Move i, k
Next
69 Microsoft Visual Basic 6.0

Image1.Left = 11500
Image1.Top = 7700
i = Image1.Left
k = Image1.Top
For i = 11500 To 0 Step -1
Image1.Move i, k
Next
Image1.Left = 0
Image1.Top = 7700
i = Image1.Left
k = Image1.Top
For k = 7700 To 0 Step -1
Image1.Move i, k
Next
Print
Print
Print " ", j
Beep
Next
End Sub

Exit Command Button twGuf


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
uGefysLwmvufpJG 70

Chapter (4)

ODBC ü Access File tm;toHk;jyKEdkifap&ef aqmif½Gufjcif;


1/ yxrtqifhtaejzifh Access 2002 jzifh Database File ESifh Table File
tm;wnfaqmufyg/ xdaYk emuf Windows Desktop Status Bar wGif½Sdaom Start Menu
tm;a½G;yg/ xdkYaemuf Setting udkxyfrHa½G;yg/ xdktcg aemufxyf Sub-Menu wpfck
ay:vmrnf/ 4if;rS Control Panel udak ½G;yg/ yH(k 76)/

yHk(76)

2/ xdt
k cg Control Panel Dialog Box ay:vmrnf/ yH(k 77)/
71 Microsoft Visual Basic 6.0

yHk(77)
3/ Control Panel Dialog Box ½Sd Icon rsm;xJrS ODBC Data Sources
[32bit] udk Double Click ESy
d yf g/ yH(k 78)ygtwdik ;f ODBC Data Source Adminis-
trator Dialog Box ay:vmrnf/
uGefysLwmvufpJG 72

yHk(78)

4/ txufyg Dialog Box wGif User DSN, System DSN, File DSN, Driv-
ers, Tracing, Connection Pooling, About [lí Tab Command 7 ckyg½Sy d gonf/
4if; Tab Command rsm;xJrS System DSN udka½G;yg/ yHk(79)ygtwdkif;jzpfay:vmrnf/
73 Microsoft Visual Basic 6.0

yHk(79)

5/ txufygyHwk iG f Add Command Button udka½G;&rnf/ xdktcg Create New


Data Source Dialog Box ay:vmrnf/ yH(k 80)/

yHk(80)

6/ txufyg Dialog Box wGif Driver do Microsoft Access [*.mdb] udk


a½G;NyD; Finish udka½G;cs,f&rnf/ ODBC Microsoft Access Setup Dialog Box ay:
vmygu Data Source Name acgif;pOfnmzuf½Sd List Box wGif rdrdBuKdufESpfouf&m
trnfwpfcu k jkd znfph u
G yf g/ Oyrm Test1 [kjznfph u
G yf g/ yH(k 81)/
uGefysLwmvufpJG 74

yHk(81)

7/ xdkYaemuf Database acgif;pOfatmuf½Sd Select... Command Button udk


a½G;cs,f&rnf/ xdktcg rdrdtvdk½Sdonfh Access 2002 Database File tm;a½G;cs,fEdkif
ap&ef Select Database Dialog Box ay:vmayrnf/ yHk(82)/

yHk(82)

8/ txufygyHk(82)rS rdrdpdwfBuKduf Database File tm; yH(k 83)ygtwdik ;f a½G;cs,f


&rnf/
75 Microsoft Visual Basic 6.0

yHk(83)

9/ xdkYaemuf OK Command Button udka½G;cs,f&rnf/ xdktcg ODBC


Microsoft Access Setup Dialog Box odkYjyefvnfa&muf½SdoGm;rnf/ yHk(84)/

yHk(84)

10/ txufyg Dialog Box wGif Database: acgif;pOfnmzufwGif rdrda½G;cs,f


cJhaomvrf;aMumif;ESifh zdkiftm;jyvdrfhrnf/ Oyrm - c:\My Documents\Test1.mdb/
xdkYaemuf Command Button wpfckjzpfaom OK udka½G;cs,f&rnf/
uGefysLwmvufpJG 76

yHk(85)

11/ xdt
k cg yH(k 85)yg ODBC Data Source Administrator Dialog Box odkY
jyefvnfa&muf½o dS mG ;Ny;D System Data Sources: acgif;pOfatmufwiG f Name → Test1,
→ Microsoft Access Driver(*.mdb) azmfjyaeayrnf/ xdkYaemuf Command
Driver→
Button wpfcjk zpfaom OK uda k ½G;cs,&f rnf/ xdt
k cg rlvae&mjzpfaom Control Panel
ae&modkYjyefvnfa&muf½SdoGm;NyD; Access 2002 Database File tm; Visual Basic
6.0 wGif toHk;jyKí&Edkifrnf/ yHk(86)/ Microsoft Access 2002 jzifhwnfaqmufxm;
aom C:\My Documents\Test1.mdb onf ODBC Data Sources (32bit) jzpfoGm;
ayrnf/
77 Microsoft Visual Basic 6.0

yHk(86)

---------------0-0-0---------------
Visual Basic 6.0 wGif ODBC Data Sources qJGwifjcif;
12/ Visual Basic 6.0 udkzGifhyg/ Project1-Form1 (Form) ½Sd Form1 wGif
atmufygyHk(87)ygtwdkif;wnfaqmufxm;&rnf/

yHk(87)

13/ xdkYaemuftcsuftvufzdkifzGifh&ef Command1, y½dk*&rfrSxGuf&ef Com-


mand2 wdkY twGufyHk(88)ygtwdkif; Program rsm;a&;om;&rnf/
uGefysLwmvufpJG 78

yHk(88)

Data Form Wizard wnfaqmufjcif;


14/ Menu Bar ½Sd Add-Ins rS Data Form Wizard uda
k ½G;yg/ yH(k 89)/

yHk(89)

15/ xdt
k cg Data Form Wizard - Introduction Dialog Box ay:vmrnf/
yHk(90)/

yHk(90)
79 Microsoft Visual Basic 6.0

16/ yH(k 90)yg Dialog Box wGif From what profile do you want to load
your setting? acgif;pOfatmuf List Box udk (None) xm;NyD; Next uda
k ½G;yg/

yHk(91)

17/ xdt
k cg txufygyH(k 91)ygtwdik ;f Data Form Wizard - Database Type
Dialog Box ay:vmNyD; 4if;xJ½Sd List Box xJwGif Access udka½G;xm;vdrfhrnf/ rdrdrS
Remote (ODBC) tm;a½G;NyD; Next udka½G;cs,f&rnf/

yHk(92)

18/ xdktcg yHk(92)ygtwdkif; Data Form Wizard - Connect Information


Dialog Box ay:vmNyD; ODBC Connect Data acgif;pOfatmuf½Sd DSN: nmzuf½dS
List Box udka½G;cs,fygu yHk(93)ygtwdkif; Dropdown List Box ay:vmygu Test1
udka½G;cs,fNyD; Next udka½G;cs,f&rnf/ yHk(94)/
uGefysLwmvufpJG 80

yHk(93)

yHk(94)

19/ xdt
k cg Data Form Wizard - Form Dialog Box ay:vmrnf/ What
name do you want for the form? acgif;pOfatmuf List Box wGif rdrBd uKu
d Ef pS o
f uf&m
trnfudk jznfhpGuf&ef/ Oyrm - Form2 [kjznfhpGufí Next udka½G;&rnf/ yHk(95)/
81 Microsoft Visual Basic 6.0

yHk(95)

20/ yHk(95)wGif Next udka½G;cs,fygu Data Form Wizard - Record Source


Dialog Box ay:vmrnf/

yHk(96)

21/ txufygyHw k iG f Record Source: List Box Dropdown Arrow tm;a½G;cs,f


NyD; Test1 udx
k m;&ef/ xdt k cg Available Fields:acgif;pOfatmufwGif Test1 Data-
base File wGif wnfaqmufxm;aom Field rsm;a&muf½v dS mvdrrhf nf/ 4if;rS rdrEd pS o
f uf
onfh Field rsm;udka½G;cs,f&rnf/ yHk(97)/
uGefysLwmvufpJG 82

yHk(97)

22/ txufygyH(k 97)wGif rdrt


d vd½k o
dS nfh Field rsm;udw
k pfcck si;f tvdu
k f Right
Arrow Command Button jzifhvnf;aumif;? Field tm;vHk;udk Right Arrow ESpf
ckyg Command Button jzifhvnf;aumif;a½G;cs,fEdkifygonf/ Column to Sort By:
acgif;pOfatmuf List Box wGif rdrdtaejzifh i,fpOfBuD;vdkufpDpOfvdkaom Field rsm;udk
a½G;cs,fvdku a½G;cs,fEdkifygonf/ xdkYaemuf Next udak ½G;cs,yf g/ yH(k 98)/

yHk(98)
83 Microsoft Visual Basic 6.0

23/ wpfzufygyH(k 98)yg Data Form Wizard - Record Source Dialog Box
wGif Next udkxyfrHa½G;cs,fyg/ Data Form Wizard - Control Selection Dialog
Box ay:vmrnf/ yH(k 99)/

yHk(99)

24/ txufygyHk(99)udk ajymif;vJrIrjyKvkyfbJ Next udx


k yfraH ½G;cs,yf g/ xdt
k cg
Data Form Wizard - Finished! Dialog Box ay:vmayrnf/ yHk(100)/

yHk(100)

25/ txufygyHk(100)wGif Finish Command Button udak ½G;cs,&f rnf/ yH(k 101)/
uGefysLwmvufpJG 84

yHk(101)
26/ yHk(101)wGif OK udka½G;cs,f&rnf/ xdktcg yHk(102)ygtwdkif;jzpfay:vmrnf/

yHk(102)

27/ Visual Basic 6.0 rS tvdktavsmufwnfaqmufay;vdkufaom Form2 jzpf


ay:vmayrnf/
---------------0-0-0---------------
85 Microsoft Visual Basic 6.0

rdrdenf;jzifh Access File toHk;jyKaomy½dk*&rfa&;om;jcif;


28/ rdrdenf;? rdrd[efjzifh Access 2002 wGif Database File wnfaqmufxm;NyD;
Visual Basic 6.0 udktoHk;jyKí Programming a&;om;Edkifygonf/ atmufazmfjyyg
yHk(103)tm; Toolbox ½Sd Icon rsm;udktoHk;jyKíwnfaqmufxm;&rnf/

yHk(103)

29/ yH(k 103)yg Form wGif Command Button udktoHk;jyKí zdkifzGifh&ef? xGuf&ef
wdu Yk kd zefw;D wnfaqmufxm;ygonf/ tqdyk g Form onf Form1 jzpfNy;D xGu&f ef Com-
mand Button udkESdyfygu 4if;y½dk*&rfxJrSxGufoGm;NyD;? zdkifzGifh&ef Command Button
udak ½G;ygu Form2 jzifph pD Ofxm;aom Microsoft Access 2002 Database File ay:vm
ayrnf/ xdkYaMumifh Form2 udkatmufygtwdkif;wnfaqmuf&ayrnf/ yHk(104)/

yHk(104)
uGefysLwmvufpJG 86

30/ yHk(104)yg Identification Number;, Rank;, Name;, Department; [k


teufa&mifjzifha&;om;xm;aompmrsm;onf Label1, Label2, Label3, Label4 wdkYjzifh
wnfaqmufxm;jcif;jzpfNy;D 4if;pmom;rsm;\nmzufwiG w f nfaqmufxm;aom Box rsm;
rSm Text Box rsm;jzifw
h nfaqmufxm;ygonf/ Add, Update, Delete, Refresh, Close
wdrYk mS Command Button rsm;jzpfMuygonf/ 4if; Command Button 5 ck\nmzufwGif
½Sdonfh Data Position Box rSm jzifwh nfaqmufxm;ygonf/ Command
Button rsm;ESifh Adodc wdkYatmufzufwGif½Sdaeaom Z,m;udk jzifh
wnfaqmufxm;Muygonf/
31/ Label1 Label \ Properties wGifatmufygtwdkif;jyifqif&ef-
(u) Name - Label1
( c) Alignment - 0 - Left Justify
( *) AutoSize - True
(C) Caption - Identification Number;
32/ Label2 Label \ Properties wGifatmufygtwdkif;jyifqif&ef-
(u) Name - Label2
( c) Alignment - 0 - Left Justify
( *) AutoSize - True
(C) Caption - Rank;
33/ Label3 Label \ Properties wGifatmufygtwdkif;jyifqif&ef-
(u) Name - Label3
( c) Alignment - 0 - Left Justify
( *) AutoSize - True
(C) Caption - Name;
34/ Label4 Label \ Properties wGifatmufygtwdkif;jyifqif&ef-
(u) Name - Label4
( c) Alignment - 0 - Left Justify
( *) AutoSize - True
(C) Caption - Department;
35/ Text1 Text \ Properties wGifatmufygtwdkif;jyifqif&ef-
(u) Name - Text1
( c) Alignment - 0 - Left Justify
( *) DataField - Identification Number
87 Microsoft Visual Basic 6.0

(C) DataSource - Adodc1


36/ Text2 Text \ Properties wGifatmufygtwdkif;jyifqif&ef-
(u) Name - Text2
( c) Alignment - 0 - Left Justify
( *) DataField - Rank
(C) DataSource - Adodc1
37/ Text3 Text \ Properties wGifatmufygtwdkif;jyifqif&ef-
(u) Name - Text3
( c) Alignment - 0 - Left Justify
( *) DataField - Name
(C) DataSource - Adodc1
38/ Text4 Text \ Properties wGifatmufygtwdkif;jyifqif&ef-
(u) Name - Text4
( c) Alignment - 0 - Left Justify
( *) DataField - Department
(C) DataSource - Adodc1
39/ Command1 Command Button \ Properties wGifatmufygtwdkif;
jyifqif&ef-
(u) Name - Command1
( c) Caption - &Add
40/ Command2 Command Button \ Properties wGifatmufygtwdkif;
jyifqif&ef-
(u) Name - Command2
( c) Caption - &Update
41/ Command3 Command Button \ Properties wGifatmufygtwdkif;
jyifqif&ef-
(u) Name - Command3
( c) Caption - &Delete
42/ Command4 Command Button \ Properties wGifatmufygtwdkif;
jyifqif&ef-
(u) Name - Command4
( c) Caption - &Refresh
uGefysLwmvufpJG 88
43/ Command5 Command Button \ Properties wGifatmufygtwdkif;
jyifqif&ef-
(u) Name - Command5
( c) Caption - &Close

44/ Adodc1 Adodc \ Properties udk yH(k 105)? yH(k 106)wdjYk zifa
h zmfjytyfygonf-
(u) ConnectionString - P r o v i d e r = M S D A S Q L . 1 ; D S N =
TEST1; UID=; PWD=;
( c) RecordSource - Select [Identification Number], Rank,
Name, Department from Test1 Order
By [Identification Number]

yHk(105) yHk(106)
89 Microsoft Visual Basic 6.0

45/ DataGrid1 DataGrid \ Properties udk yH(k 107)? yH(k 108)wdjYk zifa
h zmfjytyf
ygonf/ txufyg Form2 udk Run í&Edik af p&eftwGuf vdt
k yfaomy½d*k &rfrsm;a&;om;
&ayrnf/

yHk(107) yHk(108)
46/ Adodc1 Adodc wGif Record Position twGuf-
Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReason
Enum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As
ADODB.Recordset)
Adodc1.Caption =
"Record: " & CStr(Adodc1.Recordset. Absolute Position)
End Sub
uGefysLwmvufpJG 90

47/ Add Command Button twGuf-


Private Sub Command1_Click()
Adodc1.Recordset.AddNew
End Sub

48/ Update Command Button twGuf-


Private Sub Command2_Click()
Adodc1.Recordset.Update
End Sub

49/ Delete Command Button twGuf


Private Sub Command3_Click()
With Adodc1.Recordset
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
End Sub

50/ Refresh Command Button twGuf-


Private Sub Command4_Click()
Adodc1.Refresh
End Sub

51/ Close Command Button twGuf-


Private Sub Command5_Click()
Form2.Hide
Form1.Show
End Sub

52/ Mouse Pointer Position twGuf-


Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub

---------------0-0-0---------------
91 Microsoft Visual Basic 6.0

Chapter (5)

String ESifhqdkifaomudpö&yfrsm;
Syntax;
Len(strin/varname)
Oyrm -
MyString = "Hello World" 'Initialize Variable.
MyLen = Len(MyString) 'Returns 11.
Syntax;
Dim varname [([subscripts])][As [New] type[, varname[([subscripts])]
[As [New] type]]...
Oyrm -
'Any Value and My Value are declared as Variant by default with
values set to Empty.
Dim AnyValue, MyValue
'Explicitly declare a variable of type integer.
Dim Number As Integer
'Multiple declarations on a single line. Another Variable is of type
Variant because its type is omitted.
Dim AnotherVar, Choice As Boolean, BirthDate As Date
'DayArray is an array of Variants with 51 elements indexed, from 0
thru 50, assuming Option Base is set to 0 (default) for the
current module
Dim DayArray(50)
'Matrix is a two-dimensional array of integers.
Dim Matrix(3, 4) As Integer
'MyMatrix is a three-dimensional array of doubles with explicit bounds.
Dim MyMatrix(1 To 5, 4 To 9, 3 To 5) As Double
'BirthDay is an array of dates with indexes from 1 to 10.
Dim BirthDay(1 To 10) As Date
'MyArrau os a dynamic array of variants.
uGefysLwmvufpJG 92
Dim MyArray()
Syntax;
Str(<number>)
Oyrm -
MyString = Str(459) 'Returns " 459".
MyString = Str(-459.65) 'Returns "-459.65".
MyString = Str(459.001) 'Returns " 459.001".
Syntax;
Left(string, length)
Oyrm -
This example uses the Left Function to return a specified number of
characters form the left side of a string.
AnyString = "Hello World" 'Define String.
MyStr = Left(AnyString, 1) 'Returns "H"
MyStr = Left(AnyString, 7) 'Returns "Hello W"
MyStr = Left(AnyString, 20) 'Returns "Hello World"
Syntax;
Right(string, length)
Oyrm -
This example uses the Right Function to return a specified number of
characters form the right side of a string.
AnyString = "Hello World" 'Define String.
MyStr = Right(AnyString, 1) 'Returns "d"
MyStr = Right(AnyString, 6) 'Returns " World"
MyStr = Right(AnyString, 20) 'Returns "Hello World"

String Function rsm;udktoHk;jyKí udef;*Pef;rsm;wGufcsufjcif;


93 Microsoft Visual Basic 6.0

1/ atmufazmfjyyg Form yHpk t


H m;zefw;D wnfaqmufyg/ yH(k 109)/

2/ yHk(109)Text Box, Command Button wdkYjzifh


txufyg Form yHkpHwGif Label,
zefw;D xm;Ny;D Command Button rsm;wGif vdt
k yfaomy½d*k &rfrsm;a&;om;&efjzpfygonf/
3/ Run Command Button twGuf-
Private Sub Command1_Click()
Cls
Dim a(50) As Variant
w = Text1.Text
b=0
z = Len(Text1.Text)
Print z: Print
For i = 1 To z
a(i) = Left(Right(Str(w), z - i + 1), 1)
Print a(i) & "+";
Next
For i = 1 To z
b = b + Val(a(i))
Next
Print "=", b
c = Len(b)
d=0
Print c: Print
For j = 1 To c
uGefysLwmvufpJG 94
a(j) = Left(Right(Str(b), c - j + 1), 1)
Print a(j) & "+";
Next
For i = 1 To c
d = d + Val(a(i))
Next
Print "=", d
e = Len(d)
f=0
Print e: Print
If e >= 2 And d >= 10 Then
For j = i To c
a(j) = Left(Right(Str(d), e - j + 1), 1)
Print a(j) & "+";
Next
For i = 1 To e
f = f + Val(a(i))
Next
Print "=", f
End If
End Sub

4/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

5/ tqdyk g y½d*k &rfukd Run ygu yHk(110)twdkif;jrifawGU&rnf/


95 Microsoft Visual Basic 6.0

Syntax; yHk(110)
RSet strinvar = string
Oyrm -
MyString = "0123456789" 'Initialize String.
RSet MyString = "Right ->" 'MyString contains " Right ->".

String toHk;jyKí Fibonacci Sequence udef;pOfwef;udk½Smjcif;


6/ atmufyg Form yHpk t
H m; zefw;D wnfaqmufyg/ yH(k 111)/ 4if;wGif Label,
Text Box, Command Button wdkYjzifhzefwD;xm;NyD; Command Button rsm;wGif vdktyf
aomy½dk*&rfrsm;a&;om;&efjzpfygonf/

yHk(111)

7/ Run Command Button twGuf-


Private Sub Command1_Click()
Dim n As Variant
str1 = "1234567"
Cls
n = Text1: secondlast = 0: Last = 1
uGefysLwmvufpJG 96
For k = 3 To n
term = secondlast + Last: secondlast = Last: Last = term
RSet str1 = Str(term)
Print k, str1
Next
End Sub

8/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

9/ tqdyk gy½d*k &rfukd Run ygu atmufygyHkpHtwdkif;jrifawGU&rnf/ yHk(112)/

yHk(112)

Astrisk rsm;zefwD;jcif;
97 Microsoft Visual Basic 6.0

10/ atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 113)/ 4if;wGif Command
Button rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;
a&;om;&ef jzpfygonf/

yHk(113)

11/ Run Command Button twGuf-


Private Sub Command1_Click()
Dim a$(22, 21)
Cls
For i = 1 To 22
For j = 1 To 21
a$(i, j) = "*"
Next j
Next i
For i = 1 To 20
For j = 1 To 21 - i
a$(i, j) = "*"
Next j
Next i
For i = 1 To 22
For j = 1 To 21
Print a$(i, j);
Next j: Print
Next i
End Sub
12/ Exit Command Button twGuf-
uGefysLwmvufpJG 98
Private Sub Command2_Click()
Unload Me
End
End Sub

13/ tqdyk gy½d*k &rfukd Run ygu atmufygyHkpHtwdkif;jrifawGU&rnf/ yHk(114)/

yHk(114)

Magic Square y½dk*&rfa&;om;jcif;


14/ atmufyg Form yHpk tH m; zefw;D wnfaqmufyg/ yH(k 115)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif
vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

yHk(115)

15/ Run Command Button twGuf-


99 Microsoft Visual Basic 6.0

Private Sub Command1_Click()


str1 = "12345"
10 Cls
N = Val(Text1)
If N >= 31 Or N Mod 2 = 0 Then
Print "Between 3 and 19 ": GoTo 10
End If
Dim A(31, 31)
For i = 1 To N
For j = 1 To N
A(i, j) = 0
Next j
Next i
dat = 1: i = 1: j = N \ 2 + 1: A(i, j) = dat
For Kount = 1 To N * N - 1
i = i - 1: j = j + 1
If i < 1 And j > N Then i = i + 2: j = j - 1
If i < 1 Then i = N
If j > N Then j = 1
If A(i, j) <> 0 Then i = i + 2: j = j - 1
dat = dat + 1: A(i, j) = dat
Next: Print
Print " Magic Square "; N
Print " ~~~~~~~~~~~~ ": Print
For i = 1 To N
For j = 1 To N
RSet str1 = A(i, j): Print str1;
'Print using;" ";str1; 'A(i,j);
Next j: Print
Next i
End Sub

16/ Exit Command Button twGuf


Private Sub Command2_Click()
Unload Me
End
uGefysLwmvufpJG 100
End Sub

17/ tqdyk gy½d*k &rfukd Run ygu atmufygyHk(116)twdkif; azmfjyrnfjzpfonf/

yHk(116)

&m*Pef;½dkufxnfhygu 4if;udef;*Pef; 3 vHk;pvHk;aygif;jcif;


18/ atmufyg Form yHpk t
H m; zefw;D wnfaqmufyg/ yH(k 117)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif
vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

yHk(117)

19/ Run Command Button twGuf-


Private Sub Command1_Click()
Cls
n = Text1.Text
A = n \ 100
n = n - (A * 100)
b = n \ 10
n = n - (b * 10)
101 Microsoft Visual Basic 6.0

Print "("; A; "+"; b; "+"; n; ")"; "="; A + b + n


End Sub

20/ Exit Command Button twGuf


Private Sub Command2_Click()
Unload Me
End
End Sub

21/ tqdyk gy½d*k &rfukd Run ygu yHk(118)twdkif; azmfjyrnfjzpfonf/

yHk(118)

aemufwpfenf;
22/ atmufyg Form yHpk tH m; zefw;D wnfaqmufyg/ yH(k 119)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif
vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

yHk(119)

23/ Run Command Button twGuf-


Private Sub Command1_Click()
Cls
n = Text1.Text
sum1 = Val(Mid(Str(n),2,1))+Val(Mid(Str(n),3,1))
+Val(Mid(Str(n),4,1))
print "3 Digits Sum of ";n;" is";sum1
End Sub
uGefysLwmvufpJG 102

24/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

25/ tqdyk gy½d*k &rfukd Run ygu yHk(120)twdkif; azmfjyrnfjzpfonf/

yHk(120)

Syntax;
Mid(string, start, length)
Oyrm -
MyString = "Mid Function Demo" 'Create text string.
FirstWord = Mid(MyString, 1, 3) 'Returns "Mid".
LastWord = Mid(MyString, 14, 4) 'Returns "Demo".
MidWord = Mid(MyString, 5) 'Returns "Function Demo".

aemufwpfenf;
26/ atmufyg Form yHpk tH m; zefw;D wnfaqmufyg/ yH(k 121)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif
vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

yHk(121)

27/ Run Command Button twGuf-


Private Sub Command1_Click()
Cls
n = Text1.Text
103 Microsoft Visual Basic 6.0

s1 = Val(Mid(Trim(Str(n)), 1, 1))
Print s1
s2 = Val(Mid(Trim(Str(n)), 2, 1))
Print s2
s3 = Val(Mid(Trim(Str(n)), 3, 1))
Print s3
Print "3 Digits Sum of "; n; " is"; s1 + s2 + s3
End Sub

28/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

29/ tqdyk gy½d*k &rfukd Run ygu yHk(122)twdkif; azmfjyrnfjzpfonf/

yHk(122)

---------------0-0-0---------------
uGefysLwmvufpJG 104

Chapter (6)

Mathematics ESifhqdkifaomudpö&yfrsm;
½dk;½dk;udef;pOfwef; 1, 2, 3, 4, ...? qwdk;udef; 1, 2, 4, 8, 16, ...? xyfudef; 1, 4, 9, 16,
25, ... udef;pOfwef;wdkYudk y½dk*&rfa&;om;jcif;
1/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(123)/ 4if;wGif
rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;
a&;om;&ef jzpfygonf/

yHk(123)

2/ Run Command Button twGuf-


Private Sub Command1_Click()
'To find No., AP, GP, Square
Cls
Print 1, 1, 1, 1
For j = 2 To 22
Print j, 2 * j - 1, 2 ^ (j - 1), j ^ 2
Next
End Sub

3/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

4/ tqdyk gy½d*k &rfukd Run ygu yHk(124)twdkif; azmfjyrnfjzpfonf/


105 Microsoft Visual Basic 6.0

yHk(124)

AP udef;pOfwef;udk y½dk*&rfa&;om;jcif;
5/ atmufyg Form yHpk tH m; zefw;D wnfaqmufyg/ yH(k 125)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif
vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

yHk(125)

6/ Properties rsm;udjk yifqifjznfp


h u
G Nf y;D aemuf vdt
k yfaomy½d*k &rfrsm;udak &;om;
&rnf/
uGefysLwmvufpJG 106

7/ Run Command Button twGuf-


Private Sub Command1_Click()
'AP (Arithmetic Progression)
Cls
a = Val(Text1)
d = Val(Text2)
n = Val(Text3)
Print " No? Terms Sum "
k = 1: t = a: s = a
Print k, t, s
For k = 2 To n
t = t + d: s = s + t: Print k, t, s
Next
End Sub

8/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

9/ tqdyk gy½d*k &rfukd Run ygu yHk(126)twdkif; azmfjyrnfjzpfonf/

yHk(126)
107 Microsoft Visual Basic 6.0

GP udef;pOfwef;udk y½dk*&rfa&;om;jcif;
10/ atmufyg Form yHpk tH m; zefw;D wnfaqmufyg/ yH(k 127)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif
vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

yHk(127)

11/ Run Command Button twGuf-


Private Sub Command1_Click()
'GP (Arithmetic Progression)
Cls
a = Val(Text1)
d = Val(Text2)
n = Val(Text3)
Print " No? Terms G.P Sum "
k = 1: t = a: s = a
Print k, t, s
For k = 2 To n
t = t * d: s = s + t: Print k, t, s
Next
End Sub

12/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub
uGefysLwmvufpJG 108

13/ tqdyk gy½d*k &rfukd Run ygu yHk(128)twdkif; azmfjyrnfjzpfonf/

yHk(128)

S = 1 + 2 + 3 + ... + N udef;pOfwef;wdkYudk aygif;jcif;


14/ atmufyg Form yHpk t
H m; zefw;D wnfaqmufyg/ yH(k 129)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Properties toD;oD;udk jyifqif
jznfhpGufNyD;aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfyg
onf/

yHk(129)

15/ Run Command Button twGuf-


Private Sub Command1_Click()
'To find the sum of N terms of the series
'S = 1 + 2 + 3 + ... + N
Cls
n = Val(Text1)
If n = 0 Then End
Sum = 1
For i = 2 To n
Sum = Sum + i
109 Microsoft Visual Basic 6.0

Next
Print "The sum of the series is "; Sum Print k, t, s
End Sub

16/ Exit Command Button twGuf


Private Sub Command2_Click()
Unload Me
End
End Sub

17/ tqdyk gy½d*k &rfukd Run ygu yHk(130)twdkif; azmfjyrnfjzpfonf/

yHk(130)

S = 1 * 2 * 3 * ... * N udef;pOfwef;wdkYudk aygif;jcif;


18/ atmufyg Form yHpk t
H m; zefw;D wnfaqmufyg/ yH(k 131)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Properties toD;oD;udk jyifqif
jznfhpGufNyD;aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfyg
onf/

yHk(131)

19/ Run Command Button twGuf-


Private Sub Command1_Click()
'To find the Product of N terms of the series
'S = 1 * 2 * 3 * ... * N
Cls
n = Val(Text1)
If n = 0 Or n > 17 Then End
pro = 1
uGefysLwmvufpJG 110
For i = 2 To n
pro = pro * i
Next
Print "The Product of the series is "; pro
End Sub

20/ Exit Command Button twGuf


Private Sub Command2_Click()
Unload Me
End
End Sub

21/ tqdyk gy½d*k &rfukd Run ygu yHk(132)twdkif; azmfjyrnfjzpfonf/

yHk(132)

udef;pOfwef; S = 1 + 1/4 + 1/9 + ... + 1/N*N wdkYudk½SmazGjcif;


22/ atmufyg Form yHpk t
H m; zefw;D wnfaqmufyg/ yH(k 133)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Properties toD;oD;udk jyifqif
jznfhpGufNyD;aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfyg
onf/

yHk(133)

23/ Run Command Button twGuf-


Private Sub Command1_Click()
Cls
n = Text1
If n = 0 Then End
sum1 = 0
111 Microsoft Visual Basic 6.0

For i = 1 To n
sum1 = sum1 + 1 / i ^ 2
Next
Print "The Sum of the series is "; sum1
End Sub

23/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

24/ tqdyk gy½d*k &rfukd Run ygu yHk(134)twdkif; azmfjyrnfjzpfonf/

yHk(134)

udef;pOfwef; P = (2/3)(3/4)(4/5)...(N/N+1) wdkYudk½SmazGjcif;


25/ atmufyg Form yHpk t
H m; zefw;D wnfaqmufyg/ yH(k 135)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Properties toD;oD;udk jyifqif
jznfhpGufNyD;aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfyg
onf/

yHk(135)

26/ Run Command Button twGuf-


Private Sub Command1_Click()
Cls
n = Text1
If n = 0 Or n > 18 Then End
pro = 1
uGefysLwmvufpJG 112
For i = 1 To n
pro = pro * (i + 1) / (i + 2)
Next
Print "The Product of the series is "; pro
End Sub

27/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

28/ tqdyk gy½d*k &rfukd Run ygu yHk(136)twdkif; azmfjyrnfjzpfonf/

yHk(136)

---------------0-0-0---------------
113 Microsoft Visual Basic 6.0

Chapter (7)

Access 2002 ½Sd Database File tm; Visual Basic 6.0 ESifh Update jyKvkyfjcif;
1/ atmufyg Form yHkpHtm; zefwD;wnfaqmufxm;&rnf/ yHk(137)/ 4if;wGif
rsm;jzifzh efw;D xm;Ny;D Command Button rsm;wGif vdt
k yfaomy½d*k &rf
rsm;a&;om;&efjzpfygonf/

yHk(137)

2/ Command1 Button twGuf-


Private Sub Command1_Click()
Form1.Hide
Form2.Show
End Sub

3/ Command2 Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

4/ xdkYaemuf Form2 yHkpHtm;zefwD;wnfaqmufxm;&rnf/ yHk(138)/ 4if;wGif


, , , rsm;jzif h z ef w D ; xm;NyD ;
Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
uGefysLwmvufpJG 114

yHk(138)

5/ rSm jzifw
h nfaqmufxm;ygonf/
Adodc \ Properties wGif yHk(139)? yHk(140)ygtwdkif;jyifqifxm;&rnf-
(u) (Name) - Wado
( c) Caption - Empty
( *) ConnectionString - PROVIDER=MSDASQL;dsn= Test2;
uid=; pwd=;
(C) RecordSource - Select [Roll Number], Name,
Myanmar, English, Maths, Total from
Test2
115 Microsoft Visual Basic 6.0

yHk(139) yHk(140)
6/ Connection String \ nmzuf Box wGif Cursor csygu Ellipsis trSwf
tom;yg Command Button udk Mouse Left Click jzifha½G;cs,fygu yHk(141)yg
twdkif; Property Pages Dialog Box ay:vmrnf/ General Tab Command Button
udak ½G;cs,yf g/ Use Connection String [ka&;om;xm;onfh Option Button udak ½G;cs,f
yg/ xdaYk emuf4if;acgif;pOfatmuf List Box ü PROVIDER=MSDASQL;dsn=Test2;
uid=;pwd=;udkjznfhpGufí OK udka½G;cs,f&ayrnf/
uGefysLwmvufpJG 116

yHk(141)

7/ RecordSource \ nmzuf Box wGif Cursor csygu Ellipsis trSwtf om;


yg Command Button udk Mouse Left Click jzifha½G;cs,fygu yHk(142)ygtwdkif;
Property Pages Dialog Box ay:vmrnf/ Command Text (SQL) List Box wGif
Cursor xnfhyg/ xdkYaemuf Select [Roll Number], Name,Myanmar,English,
Maths, Total from Test2udkjznfhpGufí OK udka½G;cs,f&ayrnf/

yHk(142)

8/ Text1 Text Box \ Properties wGifatmufygtwdkif;jyifqifjznfhpGuf&ef-


(u) DataSource - Wado
( c) DataField - Roll Number
( *) Text - Empty
117 Microsoft Visual Basic 6.0

9/ Text2 Text Box \ Properties wGifatmufygtwdkif;jyifqifjznfhpGuf&ef-


(u) DataSource - Wado
( c) DataField - Name
( *) Text - Empty

10/ Text3 Text Box \ Properties wGifatmufygtwdkif;jyifqifjznfhpGuf&ef-


(u) DataSource - Wado
( c) DataField - Myanmar
( *) Text - Empty

11/ Text4 Text Box \ Properties wGifatmufygtwdkif;jyifqifjznfhpGuf&ef-


(u) DataSource - Wado
( c) DataField - English
( *) Text - Empty

12/ Text5 Text Box \ Properties wGifatmufygtwdkif;jyifqifjznfhpGuf&ef-


(u) DataSource - Wado
( c) DataField - Maths
( *) Text - Empty

13/ Text6 Text Box \ Properties wGifatmufygtwdkif;jyifqifjznfhpGuf&ef-


(u) DataSource - Wado
( c) DataField - Total
( *) Text - Empty

14/ Form2 \ Command Button rsm;twGuf vdktyfaomy½dk*&rfrsm;tm;


a&;om;&rnf/
15/ (3)bmomaygif;jcif; Command Button twGuf-
Private Sub Command1_Click()
Wado.Recordset.MoveFirst
Do While Wado.Recordset.EOF = False
Wado.Recordset("Total") = Wado.Recordset("Myanmar") +
Wado.Recordset("English") + Wado.Recordset("Maths")
Wado.Recordset.Update
Wado.Recordset.MoveNext
Loop
uGefysLwmvufpJG 118
Wado.Recordset.MoveFirst
End Sub

16/ rlvae&modkYjyefoGm;jcif; Command Button twGuf-


Private Sub Command2_Click()
Form2.Hide
Form1.Show
End Sub

17/ Record Position jyo&ef twGuf-


Private Sub Wado_MoveComplete(ByVal adReason As ADODB.Event
ReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.
EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
Wado.Caption = "Record: " & CStr(Wado.Recordset.AbsolutePosition)
End Sub

18/ tqdyk gy½d*k &rfukd Run ygu yHk(143)twdkif; azmfjyrnfjzpfonf/

yHk(143)
119 Microsoft Visual Basic 6.0

DataGrid jzifh Update jyKvkyfjcif;


19/ atmufyg Form yHkpHtm; zefwD;wnfaqmufxm;&rnf/ yHk(144)/ 4if;wGif
rsm;jzifzh efw;D xm;Ny;D Command Button rsm;wGif vdt
k yfaomy½d*k &rf
rsm;a&;om;&ef jzpfygonf/

yHk(144)

20/ zdkifzGihfjcif; Command Button twGuf-


Private Sub Command1_Click()
Form1.Hide
Form2.Show
End Sub

21/ xGufjcif; Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

22/ xdaYk emuf Form2 yHpk tH m;zefw;D wnfaqmufxm;&rnf/ þuJo h w


Ykd nfaqmuf
&mwGif Adodc, DataGrid rsm; Toolbox xJwGif½Sd&efvdktyfayonf/ Toolbox xJ½Sd
Icon vGwfaeaomrsufESmjyiftm; Mouse Pointer jzifhaxmufí Right Click udk
a½G;cs,yf g/ xdt k cg yH(k 145)ygtwdik ;f Short Cut Menu wpfckay:vmayrnf/
uGefysLwmvufpJG 120

yHk(145)

23/ yH(k 145)yg Short Cut Menu rS Components... udka½G;cs,f&rnf/ xdktcg


yHk(146)ygtwdkif; Components Dialog Box ay:vmrnf/

yHk(146)

24/ Controls Tab Command acgif ; pOf a tmuf Vertical Scroll Bar rS
Dropdown Arrow udktoHk;jyKNyD; Adodc ESifh DataGrid wdkY½Sdonfhae&mrsm;udk Check
jyKvyk &f rnf/ yH(k 147)/
121 Microsoft Visual Basic 6.0

yHk(147)

25/ xdkYaemuf Apply Command Button udak ½G;cs,yf g/ OK ae&m Command


Button wGif Close ay:vmygu4if;udka½G;cs,f&rnf/ xdktcg Toolbox xJü Adodc
ESifh DataGrid wdkY Icon rsm;a&muf½v
dS mrnf/ yH(k 148)/

yHk(148)
uGefysLwmvufpJG 122

26/ xdkYaemuf Form2 yHkpHtm;zefwD;wnfaqmufxm;&rnf/ yHk(149)/ 4if;wGif


, , , rsm;jzifhzefwD;xm;NyD; Properties rsm;udk
jyifqifjznfph u
G í
f Command Button rsm;wGif vdtk yfaomy½d*k &rfrsm;a&;om;&ef jzpfyg
onf/

yHk(149)

27/ DataGrid \ Properties wGif atmufygwdkYudkjyifqifjznfhpGuf&ef/ yHk(150)-


(u) AllowAddnew - True
( c) AllowArrows - True
( *) AllowDelete - True
(C) AllowUpdate - True
( i) DataSource - Wado
123 Microsoft Visual Basic 6.0

yHk(150)

28/ xdkYaemuf DataGrid ay:odkY Mouse Left Click jzifha½G;cs,fNyD; Mouse


Right Click udE k ydS yf g/ yH(k 151)yg Short Cut Menu ay:vmygu Retrieve Fields udk
xyfrHa½G;cs,f&rnf/
uGefysLwmvufpJG 124

yHk(151)

29/ xdt
k cg yH(k 152)yg Retrieve fields Dialog Box ay:vmygu Yes udkxyfrH
a½G;cs,fyg/

yHk(152)

30/ yHk(153)ygtwdkif; DataGrid xJwGif oufqdkif&m Fields udkawGU½Sd&ayrnf/


125 Microsoft Visual Basic 6.0

yHk(153)

31/ (3)bmomaygif;jcif; Command Button twGuf-


Private Sub Command1_Click()
Wado.Recordset.MoveFirst
Do While Wado.Recordset.EOF = False
Wado.Recordset("Total") = Wado.Recordset("Myanmar") +
Wado.Recordset("English") + Wado.Recordset("Maths")
Wado.Recordset.Update
Wado.Recordset.MoveNext
Loop
Wado.Recordset.MoveFirst
End Sub

32/ rlvae&modkYjyefoGm;jcif; Command Button twGuf-


Private Sub Command2_Click()
Form2.Hide
Form1.Show
End Sub
uGefysLwmvufpJG 126

33/ Record Position jyo&eftwGu-f


Private Sub Wado_MoveComplete(ByVal adReason As ADODB.Event
ReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.
EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
Wado.Caption = "Record: " & CStr(Wado.Recordset.AbsolutePosition)
End Sub

34/ tqdyk gy½d*k &rfukd Run ygu yHk(154)twdkif; azmfjyrnfjzpfonf/

yHk(154)

Access 2002 Database File wGif Field topfxyfxnfhí Update vkyfjcif;


35/ Access 2002 Database File jzpfaom Test2.mdb wGif Result, Amount
of Fail [lí Field topf(2)ckxyfrHxnfhyg/ xdkYaemuf Visual Basic 6.0 jzifhy½dk*&rf
a&;om;rnfqdku yxrOD;pGmyHk(155)ygtwdkif; Form1 udkwnfaqmuf&rnf/
127 Microsoft Visual Basic 6.0

yHk(155)

36/ txufyg yHk(155)wGif rsm;jzifhzefwD;xm;NyD; Command


Button rsm;wGif vdktyfaomy½dk*&rfrsm; a&;om;&ef jzpfygonf/

37/ zdkifzGihfjcif; Command Button twGuf-


Private Sub Command1_Click()
Form1.Hide
Form2.Show
End Sub

38/ xGufjcif; Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

39/ xdkYaemuf Form2 yHkpHtm; yHk(156)ygtwdkif; zefwD;wnfaqmufxm;&rnf/


uGefysLwmvufpJG 128

yHk(156)
40/ (3)bmomaygif;jcif; Command Button twGuf-
Private Sub Command1_Click()
Wado.Recordset.MoveFirst
b = 1 'Record Counter
Do While Wado.Recordset.EOF = False
Wado.Recordset("Total") = Wado.Recordset("Myanmar") +
Wado.Recordset("English") + Wado.Recordset("Maths")
If Wado.Recordset("Myanmar") < 40 Or Wado.Recordset("English")
< 40 Or Wado.Recordset("Maths") < 40 Then
Wado.Recordset("Result") = "Fail"
Else
Wado.Recordset("Result") = "Pass"
End If
If Wado.Recordset("Myanmar") < 40 And Wado.Recordset("English")
< 40 And Wado.Recordset("Maths") < 40 Then
Wado.Recordset("Amount of Fail") = "3"
ElseIf Wado.Recordset("Myanmar") < 40 And
Wado.Recordset("English") < 40 And
Wado.Recordset("Maths") >= 40 Then
Wado.Recordset("Amount of Fail") = "2"
129 Microsoft Visual Basic 6.0

ElseIf Wado.Recordset("Myanmar") < 40 And


Wado.Recordset("English") >= 40 And
Wado.Recordset("Maths") < 40 Then
Wado.Recordset("Amount of Fail") = "2"
ElseIf Wado.Recordset("Myanmar") >= 40 And
Wado.Recordset("English") < 40 And
Wado.Recordset("Maths") < 40 Then
Wado.Recordset("Amount of Fail") = "2"
ElseIf Wado.Recordset("Myanmar") < 40 And
Wado.Recordset("English") >= 40 And
Wado.Recordset("Maths") >= 40 Then
Wado.Recordset("Amount of Fail") = "1"
ElseIf Wado.Recordset("Myanmar") >= 40 And
Wado.Recordset("English") < 40 And
Wado.Recordset("Maths") >= 40 Then
Wado.Recordset("Amount of Fail") = "1"
ElseIf Wado.Recordset("Myanmar") >= 40 And
Wado.Recordset("English") >= 40 And
Wado.Recordset("Maths") < 40 Then
Wado.Recordset("Amount of Fail") = "1"
Else
Wado.Recordset("Amount of Fail") = Null
End If
Wado.Recordset.Update
Wado.Recordset.MoveNext
b=b+1
Loop
Wado.Recordset.MoveFirst
Text1.Text = b - 1
End Sub

41/ rlvae&mjyefoGm;jcif; Command Button twGuf-


Private Sub Command2_Click()
Form2.Hide
Form1.Show
End Sub
uGefysLwmvufpJG 130

42/ tqdyk gy½d*k &rfukd Run ygu yHk(157)twdkif; azmfjyrnfjzpfonf/

yHk(157)
Access 2002 Database File ½Sd Query File tm;ac:oHk;jcif;
43/ Access 2002 Database File jzpfaom Test2.mdb wGif Position [lí
Field topf(1)ckxyfrHxnfhyg/ Result Field udk Descending, Amount of Fail
Field udk Ascending, Total Field udk Descending jzifhpDxm;aom ptest2 trnf½Sd
Query File wpfckwnfaqmufxm;yg/ xdkYaemuf Visual Basic 6.0 jzifhy½dk*&rfa&;om;
rnfqdku yxrOD;pGmyHk(158)ygtwdkif; Form1 udkwnfaqmuf&rnf/

yHk(158)
131 Microsoft Visual Basic 6.0

44/ yHk(158)wGif rsm;jzifhzefwD;xm;NyD; Command Button


rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
45/ zdkifzGifhjcif; Command Button twGuf
Private Sub Command1_Click()
Form1.Hide
Form2.Show
End Sub

46/ xGufjcif; Command Button twGuf


Private Sub Command2_Click()
Unload Me
End
End Sub

47/ xdkYaemuf Form2 yHkpHtm; yHk(159)ygtwdkif; zefwD;wnfaqmufxm;&rnf/

yHk(159)
uGefysLwmvufpJG 132

48/ Adodc \ Properties wGifatmufygwdkYudkjyifqifjznfhpGuf&ef-


(Name) - Wado
Caption - Empty
ConnectionString - PROVIDER = MSDASQL; dsn = Test2; uid=;
pwd=;
RecordSource - Select [Roll Number], Name, Myanmar, English, Maths,
Total, Result, [Amount of Fail], Position from ptest2

49/ (3)bmomaygif;jcif; Command Button twGuf-


Private Sub Command1_Click()
Wado.Recordset.MoveFirst
p = Wado.Recordset("Total") 'Initialize Total
q = Wado.Recordset("Result") 'Initialize Result
r = Wado.Recordset("Amount of fail") 'Initialize Amount of Fail
a=1 'Duplicate Total
b=1 'Record Counter
Do While Wado.Recordset.EOF = False
Wado.Recordset("Total") = Wado.Recordset("Myanmar") +
Wado.Recordset("English") + Wado.Recordset("Maths")
If Wado.Recordset("Myanmar") < 40 Or Wado.Recordset("English")
< 40 Or Wado.Recordset("Maths") < 40 Then
Wado.Recordset("Result") = "Fail"
Else
Wado.Recordset("Result") = "Pass"
End If
If Wado.Recordset("Myanmar") < 40 And Wado.Recordset("English")
< 40 And Wado.Recordset("Maths") < 40 Then
Wado.Recordset("Amount of Fail") = "3"
ElseIf Wado.Recordset("Myanmar") < 40 And
Wado.Recordset("English") < 40 And
Wado.Recordset("Maths") >= 40 Then
Wado.Recordset("Amount of Fail") = "2"
ElseIf Wado.Recordset("Myanmar") < 40 And
Wado.Recordset("English") >= 40 And
Wado.Recordset("Maths") < 40 Then
133 Microsoft Visual Basic 6.0

Wado.Recordset("Amount of Fail") = "2"


ElseIf Wado.Recordset("Myanmar") >= 40 And
Wado.Recordset("English") < 40 And
Wado.Recordset("Maths") < 40 Then
Wado.Recordset("Amount of Fail") = "2"
ElseIf Wado.Recordset("Myanmar") < 40 And
Wado.Recordset("English") >= 40 And
Wado.Recordset("Maths") >= 40 Then
Wado.Recordset("Amount of Fail") = "1"
ElseIf Wado.Recordset("Myanmar") >= 40 And
Wado.Recordset("English") < 40 And
Wado.Recordset("Maths") >= 40 Then
Wado.Recordset("Amount of Fail") = "1"
ElseIf Wado.Recordset("Myanmar") >= 40 And
Wado.Recordset("English") >= 40 And
Wado.Recordset("Maths") < 40 Then
Wado.Recordset("Amount of Fail") = "1"
Else
Wado.Recordset("Amount of Fail") = Null
End If
If (p = Wado.Recordset("Total") And Wado.Recordset("Result") =
"Pass") Or (p = Wado.Recordset("Total") And q =
Wado.Recordset("Result") And r =
Wado.Recordset("Amount of Fail")) Then
Wado.Recordset("Position") = a
ElseIf (p = Wado.Recordset("Total") And Wado.Recordset("Result")
= "Fail") Then
a=a+1
Wado.Recordset("Position") = b
a=b
Else
a=a+1
Wado.Recordset("Position") = b
a=b
End If
uGefysLwmvufpJG 134
p = Wado.Recordset("Total") 'Initialize Total
q = Wado.Recordset("Result") 'Initialize Result
r = Wado.Recordset("Amount of fail") 'Initialize Amount of Fail
Wado.Recordset.Update
Wado.Recordset.MoveNext
b=b+1
Loop
Wado.Recordset.MoveFirst
Text1.Text = b - 1
End Sub

50/ rlvae&mjyefoGm;jcif; Command Button twGuf-


Private Sub Command2_Click()
Form2.Hide
Form1.Show
End Sub

51/ tqdyk gy½d*k &rfukd Run ygu yHk(160)twdkif; azmfjyrnfjzpfonf/

yHk(160)
---------------0-0-0---------------
135 Microsoft Visual Basic 6.0

Chapter (8)

Data Types rsm;\*kPfowådrsm;

Data Type Storage Size Range


Byte 1 byte 0 to 255
Boolean 2 bytes True or False
Integer 2 bytes -32,768 to 32767
Long 4 bytes -2,147,483,648 to 2,147,483,647
(long integer)
Single 4 bytes -3.402823E38 to -1.401298E-45 for negative
(single precision values; 1.401298E-45 to 3.402823E38 for
floating-point positive values
Double 8 bytes -1.79769313486232E308 to
(double-precision -4.94065645841247E-324 for negative
floating-point values; 4.94065645841247E-324 to
1.79769313486232E308 for positive values
Currency 8 bytes -922,337,203,685,477.5808 to
(scaled integer) 922,337,203,685,477.5808
Decimal 14 bytes +/-79,228,162,514,264,337,593,543,950,335
with no decimal point;
+/-79,228,162,514,264,337,593,543,950,335
with 28 places to the right of the decimal point;
smallest nonzero number is
+/-0.00000000000000000000000000001
Date 8 bytes January 1, 100 December 31, 9999
Object 4 bytes Any Object reference
String 10 bytes 0 to approximately 2 billion
(variable-length) + string length
String Length of string 1 to approximately 65,400
(fixed-length)
Variant 16 bytes Any numeric value up to the range of a Double
(with numbers)
Variant 22 bytes Same range as for variable-length String
(with characters) +string length
User-defined Number The range of each element is the same as the
(using type) required by range of its data type
elements
uGefysLwmvufpJG 136

erlemy½dk*&rfrsm;

yHk(161)

1/ yH(k 161)yg Form wGif , , wdkYjzifh


wnfaqmuf xm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
2/ Text1 TextBox \ Properties rSm -
(u) Alignment - 2 - Center
( c) Font - MS Sans Serif, Regular, 24
( *) Text - Empty

3/ Image1 Image \ Properties rSm -


(u) Picture - Phone.wmf
( c) Stretch - True

4/ Display Command Button twGuf-


Private Sub Command1_Click()
Text1.Text = Date
End Sub

5/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub
137 Microsoft Visual Basic 6.0

6/ Form Click twGuf-


Private Sub Form_Click()
Text1.Font.Bold = True
End Sub

7/ Image1 Click twGuf-


Private Sub Image1_Click()
Image1.Move Image1.Left + 50, Image1.Top - 550
MsgBox "Hello"
End Sub
---------------0-0-0---------------

yHk(162)

8/ yH(k 162)yg Form wGif , , ,


wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf
Command Button toD;oD;wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

9/ Picture1 PictureBox \ Properties rSm -


(Name) - Picture1
AutoSize - False
Picture - "C:\WINDOWS\SETUP.BMP"

10/ Text1 TextBox \ Properties rSm -


Font - MS Sans Serif, Regular, 14
Text - Empty
uGefysLwmvufpJG 138

11/ Command1 Button twGuf-


Private Sub Command1_Click()
Command1.Caption = Text1.Text
End Sub

12/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub
Private Sub Form_Load()
Picture1.Picture = LoadPicture("c:\windows\setup.bmp")
Label1.Caption = Date
Label2.Caption = Time
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii > 47 And KeyAscii <= 58 Then
KeyAscii = 8
End If
End Sub
---------------0-0-0---------------

yHk(163)
139 Microsoft Visual Basic 6.0

13/ yH(k 163)yg Form wGif , , wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
14/ Text1 TextBox \ Properties rSm -
(u) Alignment - Left Justify
( c) Font - MS Sans Serif, Regular, 12
( *) Text - Empty

15/ Add Command Button twGuf -


Private Sub Command1_Click()
List1.AddItem Text1.Text
End Sub

16/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------

yHk(164)
uGefysLwmvufpJG 140

17/ yH(k 164)yg Form wGif , , wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
18/ >> Command Button twGuf -
Private Sub Command1_Click()
Dim i As Integer
For i = 0 To List2.ListCount - 1
If List2.Selected(i) Then
List1.AddItem List2.List(i)
End If
Next i
For i = List2.ListCount - 1 To 0 Step -1
If List2.Selected(i) Then
List2.RemoveItem (i)
End If
Next i
End Sub

19/ << Command Button twGuf -


Private Sub Command2_Click()
Dim i As Integer
For i = 0 To List1.ListCount - 1
If List1.Selected(i) Then
List2.AddItem List1.List(i)
End If
Next i
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) Then
List1.RemoveItem (i)
End If
Next i
End Sub
141 Microsoft Visual Basic 6.0

20/ Add Command Button twGuf -


Private Sub Command3_Click()
List1.AddItem Text1.Text
End Sub

21/ Exit Command Button twGuf -


Private Sub Command4_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
Looping Structure
Do ... Loop
For ... Next
For Each ... Next
Do While ... Loop
Do While <Condition>
[Statements]
[Exit Do]
[Statements]
Loop
Do Until ... Loop
Do Until <Condition>
[Statements]
[Exit Do]
[Statements]
Loop
Do ... Loop While <Condition>
Do
[Statements]
Loop While <Condition>
uGefysLwmvufpJG 142
Syntax;
If <Condition> Then [Statements]
[Else elsestatements]
or
If <Condition> Then
[Statements]
[Elseif <Condition-n> Then
[elsestatements] ...
[Else
[elsestatements]]
End If
---------------0-0-0---------------

yHk(165)

22/ yH(k 165)yg Form wGif wdkYjzifhwnfaqmufxm;NyD; Properties


rsm;udjk yifqifjznfph u
G Nf y;D aemuf Command Button toD;oD;wGif vdt
k yfaom y½d*k &rfrsm;
udk a&;om;&ayrnf/
23/ General, Declaration wGif-
Private Sub Demoloop()
n=1
Do While n <= 10
MsgBox n
n=n+1
Loop
End Sub
143 Microsoft Visual Basic 6.0

Private Sub Demoloop1()


Dim i As Integer
i = 10
Do Until i < 1
MsgBox i
i=i-1
If i = 6 Then
Exit Do
End If
Loop
End Sub

24/ Command1 Command Button twGuf -


Private Sub Command1_Click()
Demoloop
End Sub

25/ Command2 Command Button twGuf -


Private Sub Command2_Click()
Demoloop1
End Sub
For ... Next
For Counter = Start To End [Step Increment]
[Statements]
Next
---------------0-0-0---------------
uGefysLwmvufpJG 144

yHk(166)

26/ yH(k 165)yg Form wGif jzifhwnfaqmufxm;NyD; Properties


rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button wGif vdktyfaomy½dk*&rfrsm;udk
a&;om;&ayrnf/
27/ Command1 Command Button wGif-
Private Sub Command1_Click()
Unload Me
End
End Sub

28/ Form Click wGif-


Private Sub Form_Click()
Print Screen.FontCount
Dim i As Integer
For i = 0 To Screen.FontCount
Print Screen.Fonts(i)
Next
End Sub
145 Microsoft Visual Basic 6.0

Select Case
Select Case <testexpression>
[Case <expressionlist1>
[Statementblock-1]]
[Case <expressionlist2>
[Statementblock-2]]
.
.
.
[Case Else
[Statementblock-n]]
End Select
InputBox
InputBox(Prompt[,Title][,default][,xpos][,ypos][,helpfile,context])
MessageBox
MessageBox(Prompt[,buttons][,Title][,helpfile,context])
---------------0-0-0---------------

yHk(167)

29/ yH(k 167)yg Form wGif , , wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
30/ = Command Button twGuf -
Private Sub Command1_Click()
num1 = Val(Text1.Text)
num2 = Val(Text2.Text)
Select Case Combo1.Text
Case "+"
uGefysLwmvufpJG 146
Text3.Text = num1 + num2
Case "-"
Text3.Text = num1 - num2
Case "*"
Text3.Text = num1 * num2
Case "/"
Text3.Text = num1 / num2
End Select
End Sub

31/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub

32/ Form Load twGuf -


Private Sub Form_Load()
Combo1.AddItem "+" 'Adding the symbol +
Combo1.AddItem "-" 'Adding the symbol -
Combo1.AddItem "*" 'Adding the symbol *
Combo1.AddItem "/" 'Adding the symbol /
End Sub
---------------0-0-0---------------

yHk(168)

33/ yH(k 168)yg Form wGif , , wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
147 Microsoft Visual Basic 6.0

34/ Run Command Button twGuf -


Private Sub Command1_Click()
Shape1.Shape = Val(Text1.Text)
End Sub

35/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------

yHk(169)

36/ yH(k 169)yg Form wGif , , wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
37/ Run Command Button twGuf -
Private Sub Command1_Click()
Line1.X1 = Val(Text1.Text)
Line1.Y1 = Val(Text2.Text)
Line1.X2 = Val(Text3.Text)
Line1.Y2 = Val(Text4.Text)
End Sub
uGefysLwmvufpJG 148

38/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------

yHk(170)

39/ yHk(170)yg Form wGif , , wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaomy½dk*&rfrsm;udka&;om;&ayrnf/
40/ Interval Zero Command Button twGuf -
Private Sub Command1_Click()
Timer1.Interval = 0
End Sub

41/ Interval Hundred Command Button twGuf -


Private Sub Command2_Click()
Timer1.Interval = 100
End Sub

42/ Exit Command Button twGuf -


Private Sub Command3_Click()
Unload Me
End
End Sub
149 Microsoft Visual Basic 6.0

43/ Timer1 Timer twGuf -


Private Sub Timer1_Timer()
Dim i As Integer
Label1.Caption = Right(Trim(Label1.Caption), Len(Trim(Label1
.Caption)) - 1) + Trim(Left(Label1.Caption, 1))
End Sub
---------------0-0-0---------------
Toolbox wGifyg0ifaom Icon rsm;ESifherlemy½dk*&rfrsm;
44/ Toolbox wGifyg0ifaom Icon rsm;udk Z,m;jzifa h zmfjytyfygonf/

Pointer PictureBox Label

TextBox Frame Command Button

CheckBox OptionButton ComboBox

ListBox HScrollBar VScrollBar

Timer DriveListBox DirListBox

FileListBox Shape Line

Image DataControl OLE


uGefysLwmvufpJG 150

yHk(171)

45/ yHk(171)yg Form wGif FileListBox, DriveListBox,


DirListBox, Image, wdkYjzifh wnfaqmufxm;NyD; Properties
rsm;udjk yifqifjznfph u
G Nf y;D aemuf Command Button toD;oD;wGiv f t
kd yfaom y½d*k &rfrsm;
udka&;om;&ayrnf/
46/ Image1 Image Properties twGuf -
(u) (Name) - Image1
( c) Stretch - True

47/ File FileListBox Properties twGuf -


(u) (Name) - File1
( c) Pattern - *.bmp;*.jpg;*.gif;*.pic;*.tif;*.ico

48/ Show Command Button twGuf -


Private Sub Command1_Click()
Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName)
End Sub

49/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
151 Microsoft Visual Basic 6.0

50/ Directory Change &eftwGuf -


Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

51/ Drive Change &eftwGuf -


Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
---------------0-0-0---------------

yHk(172)

52/ yH(k 172)yg Form wGif Frame , Shape, HScrollBar,,


VScrollBar, CheckBox, OptionButton, wd k Y j zif h
wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
53/ Exit Command Button twGuf -
Private Sub Command1_Click()
Unload Me
End
End Sub

54/ Horizontal Scroll Bar twGuf -


Private Sub HScroll1_Change()
Shape1.Width = HScroll1.Value
End Sub
uGefysLwmvufpJG 152

55/ Vertical Scroll Bar twGuf -


Private Sub VScroll1_Change()
Shape1.Height = VScroll1.Value
End Sub

56/ Option1 Button twGuf -


Private Sub Option1_Click()
If Option1.Value Then
Shape1.Shape = 0
End If
End Sub

57/ Option2 Button twGuf -


Private Sub Option2_Click()
If Option2.Value Then
Shape1.Shape = 2
End If
End Sub

58/ Option3 Button twGuf -


Private Sub Option3_Click()
If Option3.Value Then
Shape1.Shape = 4
End If
End Sub

59/ Shape1-Fill Style ESifh Shape1-Shape ud,


k pf m;jyKeyH gwfrsm;tm; Z,m;jzifh
azmfjytyfygonf-

Shape1 - Fill Style


0 Solid 4 Upward Diagonal
1 Transparent 5 Downward Diagonal
2 Horizontal Line 6 Cross
3 Vertical Line 7 Diagonal Cross
153 Microsoft Visual Basic 6.0

Shape1 - Shape
0 Rectangle 3 Circle
1 Square 4 Rounded Rectangle
2 Oval 5 Rounded Square
---------------0-0-0---------------

yHk(173)

60/ yH(k 173)yg Form wGif TextBox, Timer, wdkY


jzifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u
G Nf y;D aemuf Command Button
toD;oD;wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
61/ Text1, Text2 TextBox Properties twGuf -
(u) Alignment - 2 - Center
( c) Font - MS Sans Serif, 14, Bold
( *) Text - Empty

62/ Timer1 Timer Properties twGuf -


(u) (Name) - Timer1
( c) Interval - 1000

63/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub

64/ Form Load twGuf -


Private Sub Form_Load()
Text1.Text = Time$
uGefysLwmvufpJG 154
Text2.Text = Date$
End Sub

65/ Timer1 twGuf -


Private Sub Timer1_Timer()
Text1.Text = Time$
End Sub

66/ Command1 twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub
---------------0-0-0---------------

yHk(174)

67/ yH(k 174)yg Form wGif TextBox, wdkYjzifhwnfaqmuf


xm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif
vdktyfaomy½dk*&rfrsm;udka&;om;&ayrnf/
68/ Text1, Text2, Text3, Text4 TextBox Properties twGuf -
(u) Alignment - 2 - Center
( c) Font - MS Sans Serif, 14, Bold
( *) Text - Empty

69/ Command1 Command Button twGuf -


Private Sub Command1_Click()
Dim MyDate As Date
MyDate = Format(Text1.Text, "D-MMMM-YY")
Text2.Text = Format(MyDate, "dddd")
155 Microsoft Visual Basic 6.0

Text3.Text = Text2.Text
End Sub

70/ Command2 Command Button twGuf-


Private Sub Command2_Click()
Text4.Text = Format(Text3.Text, ">")
End Sub

71/ Exit Command Button twGuf -


Private Sub Command3_Click()
Unload Me
End
End Sub
---------------0-0-0---------------

yHk(175)

72/ yH(k 175)yg Form wGif Label, TextBox, wdkY


jzifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u
G Nf y;D aemuf Command Button
toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
73/ Text1, Text2 TextBox Properties twGuf -
Alignment - 2 - Center
Font - MS Sans Serif, 12, Bold
Text - Empty

74/ Command1 Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub
uGefysLwmvufpJG 156

75/ Text1 wGif Data xnfhonfESifh Text2 wGiftajzay:&eftwGuf -


Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Text2.Text = (Text1.Text * 9 / 5) + 32
End Sub

76/ Text2 wGif Data xnfhonfESifh Text1 wGiftajzay:&eftwGuf -


Private Sub Text2_KeyUp(KeyCode As Integer, Shift As Integer)
Text1.Text = (Text2.Text - 32) * 5 / 9
End Sub
---------------0-0-0---------------

yHk(176)

77/ yH(k 176)yg Form wGif Label, TextBox, wdkY


jzifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u
G Nf y;D aemuf Select Command
Button wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

78/ Label1 Label Properties twGuf -


(u) (Name) - Label1
( c) AutoSize - True
( *) BackStyle - Transparent
(C) Caption - Empty

79/ Text1 TextBox Properties twGuf -


(u) Alignment - 2 - Center
( c) Font - MS Sans Serif, 12, Bold
( *) Text - Empty

80/ Command1 Command Button twGuf -


Private Sub Command1_Click()
Dim n As Integer
n = Val(Text1.Text)
157 Microsoft Visual Basic 6.0

If n <= 2 Then
Select Case Text1.Text
Case 0
Label1.Caption = "Good Day"
Case 1
Label1.Caption = "Good Morning"
Case 2
Label1.Caption = "How are you?"
End Select
Else
Label1.Caption = "Invalid Option"
End If
End Sub
---------------0-0-0---------------

yHk(177)

81/ yH(k 177)yg Form xJwGif TextBox, ComboBox, Command


Button wdkYjzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf
Command Button toD;oD;wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

82/ Text1 TextBox Properties twGuf -


(u) Alignment - 2 - Center
( c) Font - MS Sans Serif, 8, Bold
( *) Text - Empty

83/ Add Command Button twGuf -


Private Sub Command1_Click()
Combo1.AddItem Text1.Text
Text1.Text = Empty
Command2.Enabled = True
End Sub
uGefysLwmvufpJG 158

84/ Delete Command Button twGuf -


Private Sub Command2_Click()
n = Combo1.ListIndex
If n <> -1 Then
Combo1.RemoveItem n
End If
End Sub

85/ Exit Command Button twGuf -


Private Sub Command3_Click()
Unload Me
End
End Sub
---------------0-0-0---------------

yHk(178)

86/ yH(k 178)yg Form wGif OptionButton, wd k Y j zif h


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Option Button,
Command Button toD;oD;wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

87/ Option Button1 twGuf -


Private Sub Option1_Click()
Form1.BackColor = QBColor(2)
End Sub
159 Microsoft Visual Basic 6.0

88/ Option Button2 twGuf -


Private Sub Option2_Click()
Form1.BackColor = QBColor(5)
End Sub

89/ Option Button3 twGuf -


Private Sub Option3_Click()
Form1.BackColor = QBColor(0)
End Sub

90/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub
Syntax;
QBColor(<Color>)
MyForm.BackColor = QBColor(ColorCode)

91/ Color Code udk,fpm;jyKeHygwfrsm;tm; Z,m;jzifh azmfjytyfygonf-

Number Color Number Color Number Color


0 Black 6 Yellow 12 Light Red
1 Blue 7 White 13 Light Magenta

2 Green 8 Grey 14 Light Yellow


3 Cyan 9 Light Blue 15 Bright White
4 Red 10 Light Green

5 Magenta 11 Light Cyan

---------------0-0-0---------------
uGefysLwmvufpJG 160

yHk(179)

92/ yHk(179)yg Form wGif OptionButton, wd k Y j zif h


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Option Button,
Command Button toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/

93/ Option Button1 twGuf -


Private Sub Option1_Click()
Form1.BackColor = QBColor(0)
End Sub

94/ Option Button2 twGuf -


Private Sub Option2_Click()
Form1.BackColor = QBColor(1)
End Sub

95/ Option Button3 twGuf -


Private Sub Option3_Click()
Form1.BackColor = QBColor(2)
End Sub

96/ Option Button4 twGuf -


Private Sub Option4_Click()
Form1.BackColor = QBColor(3)
End Sub

97/ Option Button5 twGuf -


Private Sub Option5_Click()
Form1.BackColor = QBColor(4)
End Sub
161 Microsoft Visual Basic 6.0

98/ Option Button6 twGuf -


Private Sub Option6_Click()
Form1.BackColor = QBColor(5)
End Sub

99/ Option Button7 twGuf -


Private Sub Option7_Click()
Form1.BackColor = QBColor(6)
End Sub

100/ Option Button8 twGuf -


Private Sub Option8_Click()
Form1.BackColor = QBColor(7)
End Sub

101/ Option Button9 twGuf -


Private Sub Option9_Click()
Form1.BackColor = QBColor(8)
End Sub

102/ Option Button10 twGuf -


Private Sub Option10_Click()
Form1.BackColor = QBColor(9)
End Sub

103/ Option Button11 twGuf -


Private Sub Option11_Click()
Form1.BackColor = QBColor(10)
End Sub

104/ Option Button12 twGuf -


Private Sub Option12_Click()
Form1.BackColor = QBColor(11)
End Sub
uGefysLwmvufpJG 162

105/ Option Button13 twGuf -


Private Sub Option13_Click()
Form1.BackColor = QBColor(12)
End Sub

106/ Option Button14 twGuf -


Private Sub Option14_Click()
Form1.BackColor = QBColor(13)
End Sub

107/ Option Button15 twGuf -


Private Sub Option15_Click()
Form1.BackColor = QBColor(14)
End Sub

108/ Option Button16 twGuf -


Private Sub Option16_Click()
Form1.BackColor = QBColor(15)
End Sub

109/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub
---------------0-0-0---------------

yHk(180)
163 Microsoft Visual Basic 6.0

110/ yH(k 180)yg Form wGif CheckBox, wdkYjzifhwnfaqmuf


xm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif
vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
111/ Run Command Button twGuf -
Private Sub Command1_Click()
If Check1.Value = 1 And Check2.Value = 1 And Check3.Value = 1 Then
MsgBox "Eligible for the Housing Loan", , "Housing Loan"
Else
MsgBox "Not Eligible for the Housing Loan"
End If
End Sub

112/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------

yHk(181)

113/ yH k ( 181)yg Form wG i f wd k Y j zif h w nf a qmuf x m;NyD ;


Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif vdktyf
aomy½dk*&rfrsm;udk a&;om;&ayrnf/
114/ Run Command Button twGuf -
Private Sub Command1_Click()
Dim ret_date As Date
ret_date = InputBox("Enter the Date of Joining", "Date of Joining")
If ret_date > Date Then
uGefysLwmvufpJG 164
MsgBox "Invalid Date! Re-enter"
Else
MsgBox "Date is Valid"
End If
End Sub

115/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------

yHk(182)

116/ yH(k 182)yg Form wGif Fans, Music System wdkYudk Menu Editor... jzifhvnf;
aumif; TextBox, wdkYjzifhvnf;aumif;wnfaqmufxm;NyD;
Properties rsm;ud k jyif q if j znf h p G u f N yD ; aemuf Command Button toD ; oD ; wG i f
vdktyfaomy½dk*&rfrsm; udk a&;om;&ayrnf/
117/ General, Declaration wGif -
Dim LastItem As Integer

118/ Menu Editor Dialog Box wGif -


(u) Caption - &Fans
( c) Name - Fans
( *) Caption - &Music System
(C) Name - mnMusic
165 Microsoft Visual Basic 6.0

119/ mnMusic \ Properties udk yH(k 183)ygtwdi


k ;f Index tm; 0 (Zero) xm;ay;
&rnf/ xdrk o
S my½d*k &rf Run í&ayrnf/

yHk(183)

120/ Run Command Button twGuf -


Private Sub Command1_Click()
lastitem = lastitem + 1
If lastitem > 10 Then
MsgBox "Limit Exceeded"
Else
Load mnMusic(lastitem)
mnMusic(lastitem).Caption = Text1.Text
End If
End Sub

121/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
uGefysLwmvufpJG 166

122/ tqdyk g y½d*k &rfukd Run ygu yHk(184)ygtwdkif;jrifawGU&ayrnf/

yHk(184)

---------------0-0-0---------------

yHk(185)

123/ yHk(185)yg Form wGif File, Add, Delete, Exit wdkYudk Menu Editor...
jzifhvnf;aumif;? TextBox, wdkYjzifhvnf;aumif;wnfaqmuf
xm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif
vdktyfaom y½dk*&rfrsm;udk a&;om;&ayrnf/
124/ Menu Editor Dialog Box wGif Caption ESifh Name wdjYk znfp
h u
G &f eftcsuf
rsm;tm; Z,m;jzifhazmfjytyfygonf-
Caption Name
&File mnFile
&Add mnAdd
&Delete mnDelete
E&xit mnExit
mnSep
167 Microsoft Visual Basic 6.0

125/ mnSep udk Caption a&;&efrvdyk g/ Name wGio


f m mnSep [kowfrSwfí
4if; Properties \ Index wGif 0 (Zero) ay;&ayrnf/
126/ General, Declaration wGif -
Dim LastItem As Integer

127/ Form Load wGif -


Private Sub Form_Load()
LastItem = 0
mnDelete.Enabled = False
End Sub

128/ Add Menu twGuf -


Private Sub mnAdd_Click(Index As Integer)
LastItem = LastItem + 1
Load mnSep(LastItem)
mnSep(LastItem).Caption = "ITEM" + Str(LastItem)
mnDelete.Enabled = True
End Sub

129/ Delete Menu twGuf -


Private Sub mnDelete_Click()
Unload mnSep(LastItem)
LastItem = LastItem - 1
If LastItem = 0 Then
mnDelete.Enabled = False
End If
End Sub

130/ Exit Menu twGuf -


Private Sub mnExit_Click()
Unload Me
End
End Sub
uGefysLwmvufpJG 168

131/ mnSep Click twGuf -


Private Sub mnSep_Click(Index As Integer)
MsgBox "The selected item is " + Str(Index)
End Sub

132/ tqdyk g y½d*k &rfukd Run ygu yHk(186)ygtwdkif;jrifawGU&ayrnf/

yHk(186)

133/ Add Menu udka½G;ygu ITEM rsm;wdk;vmNyD; Delete Menu a½G;ygu ITEM
rsm; ysufoGm;onfudkawGU½Sd&ayrnf/
---------------0-0-0---------------

yHk(187)

134/ yH(k 187)yg Form wGif OptionButton, ,


wdjYk zifv
h nf;aumif;wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G f
NyD;aemuf Command Button toD;oD;wGif vdt k yfaomy½d*k &rfrsm;udk a&;om;&ayrnf/
CommonDialog Control udk Toolbox twGif;odkYqJGwif&mwGif Toolbox EIwc f rf;om;
vGwaf eaomae&mwpfcu k kd Mouse Pointer ñTeí
f Right Click ESyd yf g/ yH(k 188)ygtwdik ;f
Short Cut Menu wpfckay:vmrnf/
169 Microsoft Visual Basic 6.0

yHk(188)

135/ yHk(188)wGif Components... udkxyfrHa½G;cs,fyg/ xdktcg Components


Dialog Box ay:vmrnf/ yHk(189)/ 4if;rS Microsoft Common Dialog Control
6.0 uda
k ½G;cs,Nf y;D Apply Command Button udak ½G;cs,yf g/ xdaYk emuf Close Command
Button udkxyfrHa½G;cs,f&rnf/

yHk(189)

136/ xdt
k cg Toolbox wGif yH(k 190)ygtwdik ;f CommonDialog Control a&muf½dS
vmayrnf/
uGefysLwmvufpJG 170

yHk(190)

137/ Option1-Option Properties wGif Index udk 0 (Zero) [kowfrw


S &f rnf/
138/ Run Command Button twGuf -
Private Sub Command1_Click()
If Option1(0).Value Then
CommonDialog1.ShowOpen
ElseIf Option1(1).Value Then
CommonDialog1.ShowSave
ElseIf Option1(2).Value Then
CommonDialog1.ShowColor
End If
End Sub

139/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub

140/ Form xJwGif aemufxyf Option Button jzpfay:vm&eftwGuf -


Private Sub Form_Paint()
Static F As Integer
If F <> True Then
For i = 1 To 2
Load Option1(i)
Option1(i).Top = Option1(i - 1).Top + 350
Option1(i).Visible = True
Next i
Option1(0).Caption = "Open"
171 Microsoft Visual Basic 6.0

Option1(1).Caption = "Save"
Option1(2).Caption = "Color"
Command1.Caption = "Show Dlg"
F = True
End If
End Sub

141/ txufyg y½dk*&rfudk Run ygu atmufygtwdkif;jrifawGU&rnf/ yHk(191)/

yHk(191)

---------------0-0-0---------------

yHk(192)
uGefysLwmvufpJG 172

142/ yH(k 192)yg Form wGif File, Points, Line, Clear, Exit wdkYudk Menu Editor...
jzifv
h nf;aumif;? vIy½f mS ;&rnft
h csed u
f mvudk Timer wdjYk zifv
h nf;aumif; wnfaqmuf
xm;NyD;? Timer1 Timer Properties wGif Interval-100 [k jyifqifjznfhpGufNyD;aemuf
Pulldown Menu toD;oD;wGif vdktyfaom y½dk*&rfrsm;udk a&;om;&ayrnf/

143/ Menu Editor... \jyifqifrt


I m; Z,m;jzifah zmfjyxm;ygonf/

Caption Name
&File mnFile
...&Points mnPoints
...&Lines mnLines
...&Clear mnClear
...- mnSep
...E&xit mnExit

144/ General, Declaration wGif -


Dim Points

145/ Form Load twGuf -


Private Sub Form_Load()
Points = 0
End Sub

146/ Clear Pulldown Menu twGuf -


Private Sub mnClear_Click()
Points = 0
Form1.Cls
End Sub

147/ Exit Pulldown Menu twGuf -


Private Sub mnExit_Click()
Unload Me
End
End Sub
173 Microsoft Visual Basic 6.0

148/ Lines Pulldown Menu twGuf -


Private Sub mnLines_Click()
Dim Counter
For Counter = 1 To 100 Step 1
Line -(Rnd * Form1.ScaleWidth, Rnd * Form1.ScaleHeight),
RGB(0, 0, 0)
Next
End Sub

149/ Points Pulldown Menu twGuf -


Private Sub mnPoints_Click()
Points = 1
End Sub

150/ Timer1 Timer tcsdefumv twGuf -


Private Sub Timer1_Timer()
Dim R, G, B
Dim X, Y
Dim Counter
If Points = 1 Then
For Counter = 1 To 100 Step 1
R = Rnd * 255
G = Rnd * 255
B = Rnd * 255
X = Rnd * Form1.ScaleWidth
Y = Rnd * Form1.ScaleHeight
Form1.PSet (X, Y), RGB(R, G, B)
Next
End If
End Sub

---------------0-0-0---------------
uGefysLwmvufpJG 174

yHk(193)

151/ yH(k 192)yg Form wGif Command Button wpfckwnf;jzifhomwnfaqmuf


xm;NyD;vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
152/ Form udk Click vkyfygujzpfay:vm&eftwGuf -
Private Sub Form_Click()
Dim i
ScaleHeight = 8
For i = 0 To 5
DrawStyle = i
Line (0, i + 1)-(ScaleWidth, i + 1)
Next
End Sub

153/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub

154/ tqdyk g y½d*k &rfukd Run NyD; Form xJudk Mouse Left Click vkyfygu yHk(194)
yg twdkif;jrifawGU&rnf/
175 Microsoft Visual Basic 6.0

yHk(194)

---------------0-0-0---------------

yHk(195)

155/ yH(k 195)yg Form wGif Command Button wpfckwnf;jzifhomwnfaqmuf


xm;NyD; vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
156/ Form udk Click vkyfygujzpfay:vm&eftwGuf -
Private Sub Form_Click()
Dim CX, CY, Radius
ScaleMode = 3
CX = ScaleWidth / 2
CY = ScaleHeight / 2
If CX > CY Then Limit = CY Else Limit = CX
uGefysLwmvufpJG 176
For Radius = 0 To Limit
Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Next
End Sub

157/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub

158/ tqdyk g y½d*k &rfukd Run NyD; Form xJudk Mouse Left Click vkyfygu yHk(196)
yg twdkif;jrifawGU&rnf/

yHk(196)

---------------0-0-0---------------
177 Microsoft Visual Basic 6.0

yHk(197)

159/ yH(k 197)yg TextBox, wdjYk zifv


h nf;aumif;wnfaqmuf
xm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif
vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
160/ Text1 TextBox Properties wGif -
(u) (Name) - Text1
( c) Alignment - Left Justify
( *) MultiLine - True

161/ Form Click jyKvkyf&eftwGuf -


Private Sub Form_Click()
filenum = FreeFile
Open "C:\Setupxlg.txt" For Input As filenum
Text1.Text = Input(LOF(filenum), filenum)
Close filenum
End Sub

162/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub
uGefysLwmvufpJG 178

163/ tqdyk gy½d*k &rfukd Run NyD; Form xJukd Mouse Left Click vkyyf gu yH(k 198)yg
twdkif;jrifawGU&rnf/

yHk(198)

---------------0-0-0---------------

yHk(199)

163/ yH(k 199)yg Form yHkpHwGif Label, TextBox, Frame,


Combo Box, CheckBox, wdkYjzifhvnf;aumif; wnfaqmuf
xm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif
vdktyfaom y½dk*&rfrsm;udk a&;om;&ayrnf/
179 Microsoft Visual Basic 6.0

164/ Combo1 Combo Properties wGif -


(u) Text - Fonts
( c) List - Arial, Tahoma, Times, Times New Roman
165/ Combo2 Combo Properties wGif -
(u) Text - Style
( c) List - Regular, Bold, Italic, Bold Italic
166/ Combo3 Combo Properties wGif -
(u) Text - Size
( c) List - 8, 10, 12, 14, 16, 18, 20
167/ General, Declaration wGif -
'h represents actual height of the form
'f represents actual height of the frame
Dim f, h As Integer 'the variable f and h are declared globally

168/ Checkl twGuf -


Private Sub Check1_Click()
'Executes when check box Underline is checked
If (Check1.Value = 1) Then
Label2.FontUnderline = True
Else
Label2.FontUnderline = False
End If
End Sub

169/ Check2 twGuf -


Private Sub Check2_Click()
'Executes when check box Strike Through is checked
If (Check2.Value = 1) Then
Label2.FontStrikethru = True
Else
Label2.FontStrikethru = False
End If
End Sub
uGefysLwmvufpJG 180

170/ Combol1 twGuf -


Private Sub Combo1_LostFocus()
'Executes after you selected font name
Label2.FontName = Combo1.Text
End Sub

171/ Combol2 twGuf -


Private Sub Combo2_Change()
'Executes after you selected font style
If Combo2.Text = "Italic " Or Combo2.Text = "BoldItalic " Then
Label2.FontItalic = True
Label2.FontBold = False
Else
Label2.FontItalic = False
Label2.FontBold = True
End If
End Sub

172/ Combol3 twGuf -


Private Sub Combo3_Change()
'Executes after you selected font size
Label2.FontSize = Val(Combo3.Text)
End Sub

173/ Font Command Button twGuf -


Private Sub Command1_Click()
'Executes when font button is clicked
Form1.Height = h
'Initial form height after you click on font button
Frame1.Visible = True
End Sub

174/ Preview Command Button twGuf -


Private Sub Command2_Click()
'Executes after you selected Ok button
Text1.FontName = Label2.FontName
Text1.FontSize = Label2.FontSize
If Label2.FontItalic = True Then
181 Microsoft Visual Basic 6.0

Text1.FontBold = False
Text1.FontItalic = True
Else
Text1.FontBold = True
Text1.FontItalic = False
End If
If (Check1.Value = 1) Then
Text1.FontUnderline = True
Else
Text1.FontUnderline = False
End If
If (Check2.Value = 1) Then
Text1.FontStrikethru = True
Else
Text1.FontStrikethru = False
End If
End Sub

175/ Exit Command Button twGuf -


Private Sub Command3_Click()
Unload Me
End
End Sub

176/ Form Load twGuf -


Private Sub Form_Load()
h = Form1.Height
f = Frame1.Height
Frame1.Visible = False
Form1.Height = h - f 'Initial form height before you click on font button
End Sub

177/ Text1 Change twGuf -


Private Sub Text1_Change()
Label2.Caption = Text1.Text
End Sub
---------------0-0-0---------------
uGefysLwmvufpJG 182

yHk(200)

178/ yH(k 200)yg Form yHkpHwGif Label, TextBox, wdkY


jzifw
h nfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u
G Nf y;D aemuf Command Button
toD;oD;wGifvdktyfaom y½dk*&rfrsm;udk a&;om;&ayrnf/
179/ Calculate - Command Button1 twGuf -
Private Sub Command1_Click()
Text4.Text = Val(Text1.Text) - Val(Text2.Text) + Val(Text3.Text)
End Sub

180/ Exit - Command Button2 twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
183 Microsoft Visual Basic 6.0

yHk(201)

181/ yH(k 201)yg Form yHkpHwGif DirListBox, FileListBox, Drive


ListBox, Label, Image, wdkYjzifhwnfaqmufxm;NyD;
Properties rsm;udjk yifqifjznfp
h u
G Nf y;D aemufCommand Button toD;oD;wGivf t
kd yfaom
y½dk*&rfrsm;udka&;om;&ayrnf/
182/ File1 FileListBox - Properties wGif -
(u) (Name) - File1
( c) Pattern - *.bmp;*.pic;*.jpg;*.gif;*.wmf;*.tif

183/ Label1 Label - Properties wGif -


(u) (Name) - Label1
( c) AutoSize - False
( *) Caption - Empty
(C) BorderStyle- 1 - Fixed Single
( i) WordWrap - True
uGefysLwmvufpJG 184

184/ Image1 Image - Properties wGif -


(u) (Name) - Image1
( c) Stretch - True

185/ Directory Change twGuf -


Private Sub Dir1_Change()
File1.FileName = Dir1.Path
End Sub

186/ File a½G;&eftwGuf -


Private Sub File1_Click()
Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName)
Label1.Caption = Dir1.Path & "\" & File1.FileName
End Sub

187/ Exit - Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
185 Microsoft Visual Basic 6.0

yHk(202)

188/ yH(k 202)yg Form yHkpHwGif TextBox, ListBox, Command


Button wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Com-
mand Button toD;oD;wGifvdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

189/ General, Declaration wGif -


Dim i As Integer

190/ Add Command Button twGuf -


Private Sub command1_Click()
List1.AddItem (Text1.Text)
End Sub

191/ Delete Command Button twGuf -


Private Sub Command2_Click()
List1.RemoveItem (i)
End Sub

192/ Clear Command Button twGuf -


Private Sub Command3_Click()
List1.Clear
End Sub

193/ Exit Command Button twGuf -


Private Sub Command4_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
uGefysLwmvufpJG 186

yHk(203)

194/ yHk(202)yg FormyHkpHwGif , Command Button wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaomy½dk*&rfrsm;udka&;om;&ayrnf/
195/ Run Command Button twGuf -
Private Sub Command1_Click()
With Form1.MSChart1
.chartType = VtChChartType3dArea
.ColumnCount = 10
.RowCount = 10
For Column = 1 To 10
For Row = 1 To 10
.Column = Column
.Row = Row
Next Row
Next Column
End With
End Sub
187 Microsoft Visual Basic 6.0

196/ Exit Command Button twGuf -


Private Sub Command4_Click()
Unload Me
End
End Sub

197/ txufygy½dk*&rfudk Run ygu yHk(204)ygtwdkif;jrifawGU&ayrnf/

yHk(204)

---------------0-0-0---------------
uGefysLwmvufpJG 188

yHk(205)

yHk(206)
189 Microsoft Visual Basic 6.0

198/ yHk(205)ESifh yHk(206)yg Form yHkpHrsm;wGif , ,


Label, TextBox, CheckBox, Command Button wdkYjzifhwnfaqmuf
xm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif
vdktyfaom y½dk*&rfrsm;udk a&;om;&ayrnf/
199/ Check1 twGuf -
Private Sub Check1_Click()
If Check1.Value = vbChecked Then
MSChart1.ShowLegend = True
Else
MSChart1.ShowLegend = False
End If
End Sub

200/ Refresh Command Button twGuf -


Private Sub Command1_Click()
MSChart1.Row = 1
MSChart1.Column = 1
MSChart1.Data = Text1.Text
MSChart1.Row = 2
MSChart1.Column = 1
MSChart1.Data = Text2.Text
MSChart1.Row = 3
MSChart1.Column = 1
MSChart1.Data = Text3.Text
MSChart1.Row = 1
MSChart1.Column = 2
MSChart1.Data = Text4.Text
MSChart1.Row = 2
MSChart1.Column = 2
MSChart1.Data = Text5.Text
MSChart1.Row = 3
MSChart1.Column = 2
MSChart1.Data = Text6.Text
MSChart1.Row = 1
uGefysLwmvufpJG 190
MSChart1.Column = 3
MSChart1.Data = Text7.Text
MSChart1.Row = 2
MSChart1.Column = 3
MSChart1.Data = Text8.Text
MSChart1.Row = 3
MSChart1.Column = 3
MSChart1.Data = Text9.Text
End Sub

201/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
191 Microsoft Visual Basic 6.0

yHk(207)

202/ yH(k 207)yg Form yHkpHwGif , Command Button wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGifvdktyfaomy½dk*&rfrsm;udka&;om;&ayrnf/
203/ MSFlexGrid1 MSFlexGrid Properties twGuf -
(u) Cols - 13
( c) Rows - 13
204/ Add Command Button twGuf -
Private Sub Command1_Click()
Form1.Caption = "Addition Program"
Dim x, y
For x = 1 To 12 Step 1
MSFlexGrid1.Row = x
For y = 1 To 12 Step 1
MSFlexGrid1.Col = y
MSFlexGrid1.Text = x + y
Next
Next
End Sub
uGefysLwmvufpJG 192
205/ Subtract Command Button twGuf -
Private Sub Command2_Click()
Form1.Caption = "Subtraction Program"
Dim x, y
For x = 1 To 12 Step 1
MSFlexGrid1.Row = x
For y = 1 To 12 Step 1
MSFlexGrid1.Col = y
MSFlexGrid1.Text = x - y
Next
Next
End Sub

206/ Division Command Button twGuf -


Private Sub Command3_Click()
Form1.Caption = "Division Program"
Dim x, y
For x = 1 To 12 Step 1
MSFlexGrid1.Row = x
For y = 1 To 12 Step 1
MSFlexGrid1.Col = y
MSFlexGrid1.Text = x / y
Next
Next
End Sub

207/ Multiplication Command Button twGuf -


Private Sub Command4_Click()
Form1.Caption = "Multiplication Program"
Dim x, y
For x = 1 To 12 Step 1
MSFlexGrid1.Row = x
For y = 1 To 12 Step 1
MSFlexGrid1.Col = y
MSFlexGrid1.Text = x * y
193 Microsoft Visual Basic 6.0

Next
Next
End Sub

208/ Grid Line Width Command Button twGuf -


Private Sub Command5_Click()
If MSFlexGrid1.GridLineWidth < 4 Then
MSFlexGrid1.GridLineWidth = MSFlexGrid1.GridLineWidth + 1
Else
MSFlexGrid1.GridLineWidth = 1
End If
End Sub

209/ Exit Command Button twGuf -


Private Sub Command6_Click()
Unload Me
End
End Sub

210/ Form Load twGuf -


Private Sub Form_Load()
Dim a As Integer
MSFlexGrid1.Row = 0
For a = 1 To 12
MSFlexGrid1.Col = a
MSFlexGrid1.Text = Str(a)
Next
MSFlexGrid1.Col = 0
For a = 1 To 12
MSFlexGrid1.Row = a
MSFlexGrid1.Text = Str(a)
Next
End Sub
uGefysLwmvufpJG 194
211/ yH(k 207)yg Form yHkpH Program udk Run yguatmufygtwdkif;jrifawGU&rnf/
yH(k 208)/

yHk(208)

212/ Add Command Button udka½G;cs,fygu yHk(209)ygtwdkif;jrifawGU&rnf/

yHk(209)
195 Microsoft Visual Basic 6.0

213/ Subtract Command Button udak ½G;cs,y


f gu yH(k 210)ygtwdik ;f jrifawGU&rnf/

yHk(210)

214/ Division Command Button udak ½G;cs,y


f gu yH(k 211)ygtwdik ;f jrifawGU&rnf/

yHk(211)
uGefysLwmvufpJG 196
215/ Multiplication Command Button udak ½G;cs,y
f gu yH(k 212)ygtwdik ;f jrifawGU
&rnf/

yHk(212)

216/ Grid Line Width Command Button udka½G;cs,fyguyHk(213)ygtwdkif;


jrifawGU&rnf/

yHk(213)

---------------0-0-0---------------
197 Microsoft Visual Basic 6.0

yHk(214)

217/ yH(k 214)yg Form yHkpHwGif , Label, Command But-


ton wdYk jzifw
h nfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u
G Nf y;D aemuf Command
Button toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/

218/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub

219/ Form Load twGuf -


Private Sub Form_Load()
MSFlexGrid1.Cols = 6
MSFlexGrid1.Rows = 7
End Sub

220/ Grid Line Change &eftwGuf -


Private Sub MSFlexGrid1_RowColChange()
Msg = "Active Cell: " & Chr(64 + MSFlexGrid1.Col)
Msg = Msg & MSFlexGrid1.Row
Label1.Caption = Msg
End Sub

221/ tqdyk g y½d*k &rfukd Run Ny;D rdrt


d vd½k &dS m Row (or) Column wdu
Yk akd ½G;cs,yf gu
Grid Line Cell tuGuf½Sd Cell Reference udk yHk(215)ygtwdkif;azmfjyvdrfhrnf/
uGefysLwmvufpJG 198

yHk(215)

---------------0-0-0---------------

yHk(216)

222/ yH(k 216)yg Form yHkpHwGif , Command Button wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGifvdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
223/ RichTextBox1 - RichTextBox Properties twGuf -
(u) (Name) - RichTextBox1
( c) Font - MS Sans Serif, Bold, 12
( *) ScrollBars - 3 - rtfBoth

224/ RichTextBox2 - RichTextBox Properties twGuf -


(u) (Name) - RichTextBox2
( c) Font - MS Sans Serif, Regular, 8
( *) ScrollBars - 3 - rtfBoth
199 Microsoft Visual Basic 6.0

225/ Add Text Command Button twGuf -


Private Sub Command1_Click()
RichTextBox2.Text = RichTextBox2.Text & RichTextBox1.SelText
End Sub

226/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub

227/ Form Load twGuf -


Private Sub Form_Load()
RichTextBox1.FileName = "c:\tm.rtf"
End Sub

228/ txufyg y½dk*&rfudk Run ygu yHk(217)ygtwdkif;awGUjrif&rnf/

yHk(217)
uGefysLwmvufpJG 200
229/ yH(k 217)yg b,fbufwiG ½f adS eaompmom;tm; Selected Text vkyNf y;D ? yH(k 218)?
Add Text Command Button udka½G;cs,fygu yHk(219)ygtwdkif;jzpfay:vmrnf/

yHk(218)

yHk(219)

---------------0-0-0---------------
201 Microsoft Visual Basic 6.0

yHk
(220)

230/ yH(k 220)yg Form yHkpHwGif , , Com-


mand Button wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf
Command Button toD;oD;wGifvdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

231/ Open File Command Button twGuf -


Private Sub Command1_Click()
CommonDialog1.DialogTitle = "Open File"
CommonDialog1.Filter = "Text File|*.txt|Rich Text File|*.rtf"
CommonDialog1.ShowOpen
If CommonDialog1.FilterIndex = 1 Then
RichTextBox1.LoadFile CommonDialog1.FileName, rtfText
Else
RichTextBox1.LoadFile CommonDialog1.FileName, rtfRTF
End If
Me.Caption = CommonDialog1.FileName
End Sub

232/ Save File Command Button twGuf -


Private Sub Command2_Click()
CommonDialog1.Filter = "Text File|*.txt|Rich Text File|*.rtf"
CommonDialog1.ShowSave
If CommonDialog1.FilterIndex = 1 Then
RichTextBox1.SaveFile CommonDialog1.FileName, rtfText
Else
RichTextBox1.SaveFile CommonDialog1.FileName, rtfRTF
End If
End Sub
uGefysLwmvufpJG 202
233/ Fonts Command Button twGuf -
Private Sub Command3_Click()
CommonDialog1.Flags = cdlCFEffects + cdlCFBoth
CommonDialog1.ShowFont
With RichTextBox1
.SelBold = CommonDialog1.FontBold
.SelFontName = CommonDialog1.Name
.SelFontSize = CommonDialog1.FontSize
.SelItalic = CommonDialog1.FontItalic
.SelStrikeThru = CommonDialog1.FontStrikethru
.SelUnderline = CommonDialog1.FontUnderline
.SelColor = CommonDialog1.Color
End With
End Sub

234/ Exit Command Button twGuf -


Private Sub Command4_Click()
Unload Me
End
End Sub

235/ Form tus,ftusOf;jyKvkyf&eftwGuf -


Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then Exit Sub
RichTextBox1.Height = Me.Height - 1260
RichTextBox1.Width = Me.Width - 285
Command1.Top = Me.Height - 915
Command2.Top = Me.Height - 915
Command3.Top = Me.Height - 915
Command4.Top = Me.Height - 915
End Sub

236/ Form Load twGuf -


Private Sub Form_Load()
Form1.Caption = "Sample 36"
End Sub
203 Microsoft Visual Basic 6.0

237/ tqdyk g y½d*k &rfukd Run yguyHk(221)ygtwdkif;jrifawGU&rnf/

yHk(221)
238/ Open File Command Button udka½G;cs,fygu yHk(222)ygtwdkif;jrifawGU
&rnf/

yHk(222)
uGefysLwmvufpJG 204
239/ wpfzufyg Dialog Box wGif Files of type: nmzuf½Sd List Box ü
Dropdown Arrow jzpfaom udka½G;cs,fygu Text File ESifh Rich Text Format
File trsK;d tpm; (2)ckxr
J S BuKu
d &f mzdik t
f rsK;d tpm;udak ½G;cs,í
f Open Command Button
udka½G;cs,fygu a½G;cs,fjcif;cH&aom *.txt (or) *.rtf File rsm;yGiv hf mayrnf/ yH(k 223)/

yHk(223)

---------------0-0-0---------------
Microsoft Windows Common Controls wGifyg0ifaom Icon rsm;
240/ atmufygZ,m;jzifhazmfjytyfygonf-

Common Controls wGifyg0ifaom Icon rsm;

TabStrip Toolbar StatusBar

ProgressBar TreeView ListView

ImageList Slider ImageCombo


205 Microsoft Visual Basic 6.0

yHk(224)

241/ yH(k 224)yg Form yHkpHwGif TextBox, Toolbar,, Command


Button wdkYjzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Com-
mand Button toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/

242/ Text1 - Text Properties twGuf -


(u) (Name) - Text1
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - MS Sans Serif, Regular, 10
( i) MultiLine - True
( p) ScrollBar - 3 - Both

243/ Toolbar1 - Toolbar Properties twGuf -


(u) (Name) - Toolbar1
( c) Alignment - 0 - vbAlignNone
( *) BorderStyle- 1 - ccFixedSingle

244/ Form yHkpHtwGif;½Sd Toolbar udka½G;cs,fí Right Click ESy d yf g/ xdaYk emuf
Properties udak ½G;cs,y
f gu yH(k 225)ygtwdik ;f Property Pages Dialog Box ay:vmrnf/
uGefysLwmvufpJG 206

yHk(225)

245/ Property Pages Dialog Box xJ½Sd General, Buttons, Picture Tab
Command Button (3)ckxJrS Buttons Tab Command Button udka½G;cs,fyg/ xdkYaemuf
4if;xJwGifyg0ifaom tcsuftvufrsm;tm;atmufazmfjyygZ,m;twdkif; jyifqifjznfh
pGuf&ef -

Index Caption Key Tag


1 Cut Button1 1
2 Copy Button2 2
3 Paste Button3 3

246/ Toolbar xJ½Sd Button rsm;twGuf -


Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Button2":
Clipboard.Clear
207 Microsoft Visual Basic 6.0

Clipboard.SetText Text1.SelText
Case "Button1":
Clipboard.Clear
Clipboard.SetText Text1.SelText
Text1.Text = " "
Case "Button3":
Text1.SelText = Clipboard.GetText()
End Select
End Sub

247/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub

248/ tqdyk gy½d*k &rfukd Run NyD; Text Box xJwiG pf mrsm;½du
k Ef ydS í
f rdrt
d vd½k &dS mpmrsm;
udk Selected Text (or) Drag jyKvkyfum ul;jcif;? jzwfjcif;? uyfjcif;wdkYudkaqmif½GufEdkifyg
onf/ y½d*k &rfxrJ S xGuv f ykd gu Exit Command Button udka½G;cs,f&efjzpfygonf/
---------------0-0-0---------------

yHk(226)

249/ yH(k 226)yg Form yHkpHwGif Toolbar, StatusBar,, Command


Button wdkYjzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Com-
mand Button toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
uGefysLwmvufpJG 208
250/ Toolbar1 - Toolbar Properties twGuf -
(u) (Name) - Toolbar1
( c) Align - 1 - vbAlignTop

251/ Menu Editor Dialog Box wGifatmufygZ,m;twdkif;jyifqifyg&ef-

Index Caption Key Tag


1 Subject One Sub1 1
2 Subject Two Sub2 2
3 Subject Three Sub3 3
4 Subject Four Sub4 4

252/ StatusBar1 - StatusBar Properties twGuf -


(u) (Name) - StatusBar1
( c) Align - 2 - vbAlignBottom

253/ Add Button Command Button twGuf -


Private Sub Command1_Click()
Static i As Integer
Dim c As String
i=i+1
c = InputBox("Enter Button Title")
Toolbar1.Buttons.Add i, , c
End Sub
Private Sub Command1_GotFocus()
StatusBar1.Panels(1).Text = "Click to Add a Button of the Toolbar"
End Sub

254/ Delete Button Command Button twGuf -


Private Sub Command2_Click()
Dim i As Integer
i = InputBox("Enter Button No. to Delete")
Toolbar1.Buttons.Remove i
End Sub
209 Microsoft Visual Basic 6.0

Private Sub Command2_GotFocus()


StatusBar1.Panels(1).Text = "Click to Delete a Button from the Toolbar"
End Sub

255/ Add Panel Command Button twGuf -


Private Sub Command3_Click()
Static i As Integer
Dim c As String
i=i+1
If StatusBar1.Panels.Count = 16 Then
MsgBox "You can add only 16 Panels in a Status Bar"
Exit Sub
End If
c = InputBox("Enter Panel Title")
StatusBar1.Panels.Add i, , c
StatusBar1.Panels(i).AutoSize = sbrSpring
End Sub
Private Sub Command3_GotFocus()
StatusBar1.Panels(1).Text = "Click to Add a Panel to the Status Bar"
End Sub

256/ Delete Panel Command Button twGuf -


Private Sub Command4_Click()
Dim i As Integer
i = InputBox("Enter Panel No. to Delete")
StatusBar1.Panels.Remove i
End Sub
Private Sub Command4_GotFocus()
StatusBar1.Panels(1).Text="Click to Delete a Panel from the Status Bar"
End Sub

257/ Exit Command Button twGuf -


Private Sub Command5_Click()
Unload Me
End
End Sub
uGefysLwmvufpJG 210
258/ Status Bar Panel Click twGuf -
Private Sub StatusBar1_PanelClick(ByVal Panel As MSComctlLib.Panel)
MsgBox "You have Clicked" & Panel.Text
End Sub

259/ Tool Bar Button Click twGuf -


Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
MsgBox "You have Clicked" & Button.Caption
End Sub

260/ txufygy½dk*&rfudk Run NyD; Add Button udka½G;cs,fygu Enter Button


Title \ acgif;pOfatmuf List Box wGif rdrt
d vd½k &dS mpmom;ud½k u
kd Ef ydS Nf y;D OK udak ½G;cs,f
yg/ yH(k 227)? yH(k 228)/

yHk(227)

yHk(228)
211 Microsoft Visual Basic 6.0

261/ Delete Button udka½G;cs,fygu Enter Button No. to Delete \acgif;pOf


atmuf List Box wGif rdrzd ,f½mS ;vdo
k nft
h rSwpf Ofu½kd u
kd Ef ydS Nf y;D OK udak ½G;cs,yf g/ yH(k 229)?
yH(k 230)/

yHk(229)

yHk(230)

262/ Add Panel udka½G;cs,fygu Enter Panel Title \acgif;pOfatmuf List


Box wGif rdrdtvdk½Sd&mpmom;udk½dkufESdyfNyD; OK udka½G;cs,fyg/ yHk(231)? yHk(232)/
uGefysLwmvufpJG 212

yHk(231)

yHk(232)

263/ DeletePanel udka½G;cs,fygu Enter Button No. to Delete \acgif;pOf


atmuf List Box wGif rdrzd ,f½mS ;vdo
k nft
h rSwpf Ofu½kd u
kd Ef ydS Nf y;D OK udak ½G;cs,yf g/ yH(k 233)?
yH(k 234)/
213 Microsoft Visual Basic 6.0

yHk(233)

yHk(234)

---------------0-0-0---------------
uGefysLwmvufpJG 214

yHk(235)

264/ yH(k 235)yg Form yHkpHwGif ProgressBar,, Command Button wdkYjzifh


wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGifvdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
265/ ProgressBar1 - ProgressBar Properties twGuf -
(u) (Name) - ProgressBar1
( c) Align - 0 - vbAlignNone
( *) BorderStyle- 1 - ccFixedSingle
(C) Max - 30000
( i) Min - 1

266/ Run Command Button twGuf -


Private Sub Command1_Click()
Dim n1 As Integer
For n1 = 1 To 30000
Form1.Caption = "Processing Step " & Trim$(CStr(n1)) & " of 30000"
ProgressBar1 = n1
Next n1
End Sub

267/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
215 Microsoft Visual Basic 6.0

yHk(236)

268/ yHk(235)yg Form yHkpHwGif Slider, TextBox, Command


Button wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Com-
mand Button toD;oD;wGifvdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

269/ Form Load twGuf -


Private Sub Form_Load()
Text1.Width = 6000 'Set a minimum width for the TextBox
Slider1.Left = Text1.Left 'Align the Slider to the TextBox
'Match the width of the Slider to the TextBox
Slider1.Max = Text1.Width
'Place the Slider a little below the TextBox
Slider1.Top = Text1.Top + Text1.Height + 50
'Set tickfrequency to a fraction of the Max value
Slider1.TickFrequency = Slider1.Max * 0.1
'SetLargeChange and SmallChange value to a fraction of Max
Slider1.LargeChange = Slider1.Max * 0.1
Slider1.SmallChange = Slider1.Max * 0.01
End Sub

270/ Slider1 Change twGuf -


Private Sub Slider1_Change()
'If the slider is under 1/3 the size of the textbox, no change.
'Else, match the width of the textbox to the Slider's value
If Slider1.Value > Slider1.Max / 3 Then
Text1.Width = Slider1.Value
End If
End Sub
uGefysLwmvufpJG 216
271/ Exit Command Button twGuf -
Private Sub Command2_Click()
Unload Me
End
End Sub

272/ tqdkyg y½dk*&rfudk Run yguyHk(237)ygtwdkif;jrifawGU&rnfjzpfNyD; Slider


\twd;k ^ tavsmah jymif;Munfyh gu Text Box tus,^f tusO;f jzpfomG ;onfukd jrifawGU&
ayrnf/

yHk(237)

---------------0-0-0---------------

yHk(238)

273/ yH(k 238)yg Form yHkpHwGif ImageList, PictureBox, Com-


mand Button wdkY jzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf
Command Button toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
217 Microsoft Visual Basic 6.0

273/ Picture1 - PictureBox Properties twGuf -


(u) (Name) - Picture1
( c) Align - None
( *) AutoSize - True
(C) BorderStyle - 1 - Fixed Single

274/ Form yHkpHtwGif;½Sd ImageList udka½G;cs,fí Right Click ESy d yf g/ xdaYk emuf
Properties udak ½G;cs,y
f gu yH(k 239)ygtwdik ;f Property Pages Dialog Box ay:vmrnf/

yHk(239)

275/ Property Pages Dialog Box xJ ½ S d General, Images, Color Tab


Command Button (3)ckxJrS Images Tab Command Button udka½G;cs,fyg/ xdkYaemuf
4if;xJwiG yf g0ifaom Insert Picture... Command Button udak ½G;cs,yf g/ xdt
k cg rdrt
d vdk
½Sdonfh *.bmp File (odkYr[kwf) *.ico File ½Sdonfh vrf;aMumif;rsm;udk½SmazGa½G;cs,fí
zdik rf sm;tm; qJw
G if&rnf/ yH(k 240)/
uGefysLwmvufpJG 218

yHk(240)

276/ yHk(240)wGif Open udka½G;cs,fyguyHk(239)wGifazmfjyxm;onfhtwdkif; Club.


bmp File a&mufoGm;vdrfhrnf/ txufyg y½dk*&rfudk Run ygu rdrt d vd½k o
dS nfh Image
qJw
G ifvykd gu &½Srd nfjzpfygonf/ yH(k 241)/

yHk(241)

---------------0-0-0---------------
219 Microsoft Visual Basic 6.0

yHk(242)

277/ yH(k 242)yg Form yHkpHwGif TabStrip, TextBox, Command


Button wdkYjzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Com-
mand Button ESifh Tab toD;oD;twGufvdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

278/ Form yHkpHtwGif;½Sd TabStrip udka½G;cs,fí Right Click ESy d yf g/ xdaYk emuf
Properties udak ½G;cs,y
f gu yH(k 243)ygtwdik ;f Property Pages Dialog Box ay:vmrnf/

yHk(243)
uGefysLwmvufpJG 220
279/ Property Pages Dialog Box xJ ½ S d General, Tabs, Font, Picture
Command Button (4)ckxJrS Tabs Tab Command Button udka½G;cs,fyg/ xdkYaemuf
4if;xJwGif yg0ifaomtcsuftvufrsm;udk atmufygZ,m;twdkif;jznfhpGuf&ef -

Index Caption Tag


1 Department One
2 Items Two
3 Branches Three

280/ Tab Command Button rsm; Click vkyf&eftwGuf -


Private Sub TabStrip1_Click()
If TabStrip1.SelectedItem.Tag = "One" Then
Text1.Text = "Sales Department"
Text2.Text = "Purchase Department"
Text3.Text = "Admin Department"
ElseIf TabStrip1.SelectedItem.Tag = "Two" Then
Text1.Text = "Keyboard"
Text2.Text = "Monitor"
Text3.Text = "Hard Disk"
ElseIf TabStrip1.SelectedItem.Tag = "Three" Then
Text1.Text = "London"
Text2.Text = "New York"
Text3.Text = "Singapore"
End If
End Sub

281/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub

282/ tqdyk g y½d*k &rfukd Run yguyHk(244)ygtwdkif;jrifawGU&rnf/


221 Microsoft Visual Basic 6.0

yHk(244)

283/ yH(k 244)wGif Tab Command Button wpfcjk zpfaom Department udak ½G;cs,f
ygu yH(k 245)ygtwdik ;f Department ESifhqdkifaomXmersm;udk azmfjyrnfjzpfonf/

yHk(245)

284/ yHk(245)wGif Tab Command Button wpfckjzpfaom Items udka½G;cs,fygu


yHk(246) ygtwdkif; Item ESifhqdkifaomudpö&yfrsm;udk azmfjyrnfjzpfonf/
uGefysLwmvufpJG 222

yHk(246)

285/ yHk(246)wGif Tab Command Button wpfckjzpfaom Branches udka½G;cs,fyg


u yHk(247)ygtwdkif; Branches ESifhqdkifaomudpö&yfrsm;udk azmfjyrnfjzpfonf/

yHk(247)

286/ þy½dk*&rfxJrS xGufvdkygu Command Button wpfckjzpfaom Exit udk


a½G;cs,f&efjzpf ygonf/
---------------0-0-0---------------
223 Microsoft Visual Basic 6.0

Microsoft Calendar Control (Form twGif;jyu©'defxnfhjcif;)


287/ yH(k 248)yg Form yHkpHwGif Calendar, Command Button wdkYjzifh
wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
twGufvdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

yHk(248)

288/ Exit Command Button twGuf -


Private Sub Command1_Click()
Unload Me
End
End Sub

289/ tqdyk g y½d*k &rfukd Run ygu ,aeYwiG ½f adS ernfh &uf? v? ckEpS f jyu©'ed u
f akd zmfjy
rnfjzpfonf/

---------------0-0-0---------------
uGefysLwmvufpJG 224
Execute File udk y½dk*&rfjzifhvSrf;ac:toHk;jyKjcif;
290/ yHk(249)yg Form yHkpHwGif OLE, Command Button wdkYjzifh
wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;twGuf vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

yHk(249)

291/ Call Indirect Command Button twGuf -


Private Sub Command1_Click()
OLE1.CreateLink "c:\pm65\pm65.exe"
End Sub

291/ Call Direct Command Button twGuf -


Private Sub Command2_Click()
Call Shell("c:\pm65\pm65.exe c:\vb6\vb601.p65", 1)
End Sub

292/ Exit Command Button twGuf -


Private Sub Command3_Click()
Unload Me
End
End Sub

293/ tqdyk gy½d*k &rfukd Run ygu yHk(250)ygtwdkif;jrifawGU&rnf/


225 Microsoft Visual Basic 6.0

yHk(250)

294/ txufygyHk(250)wGif Call Indirect Command Button Sub udak ½G;cs,yf gu


yHk(251)ygtwdkif;azmfjyrnf/

yHk(251)

295/ yHk(251)wGif OLE Box xJodkYa&mufaeaom Page Maker 6.5 Icon tm;
Double Click ESdyfjcif;jzifh Page Maker 6.5 Application Package Run vmayrnf/
Call Direct Command Button udka½G;cs,fjcif;jzifh Page Maker 6.5 Application
Package Run vmrnfhtjyif c:\vb6\vb601.p65 zdi k yf gwdu
k ½f u
kd yf iG v
hf mNy;D tvd½k &dS mjyKvyk f
Edik af yrnf/ 4if;y½d*k &rfrx
S u
G v
f ykd gu Exit Command Button tm;a½G;cs,&f efjzpfonf/
---------------0-0-0---------------
uGefysLwmvufpJG 226
jr§m;rsm;udkywfjcmvnfvSnfhonfhy½dk*&rfudka&;jcif;
296/ yHk(248)yg Form yHkpHwGif Image, Command Button wdkYjzifh
wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
rsm;twGufvdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/

yHk(252)

297/ Form1 - Form Properties wGif -


WindowState - 2 - Maximized

298/ General wGif -


Private Sub rotate()
For t = 0 To 100
Next
End Sub

299/ Run Command Button twGuf -


Private Sub Command1_Click()
For k = 1 To 10
'Call Shell("c:\windows\mplayer.exe c:\MyDocu~1\Romance.wav",1)
Image1.Left = 0
Image1.Top = 0
Image1.Visible = True
Image2.Visible = False
Image3.Visible = False
227 Microsoft Visual Basic 6.0

Image4.Visible = False
i = Image1.Left
j = Image1.Top
For i = 0 To 11500 Step 1
rotate
Image1.Move Image1.Left + 1, Image1.Top
Next i
Image1.Left = 0
Image1.Top = 0
''''''''''''''
Image2.Left = 11500
Image2.Top = 0
Image1.Visible = False
Image2.Visible = True
Image3.Visible = False
Image4.Visible = False
For j = 0 To 8300 Step 1
rotate
Image2.Move Image2.Left, Image2.Top + 1
Next j
Image2.Left = 11500
Image2.Top = 0
''''''''''''''
Image3.Left = 11500
Image3.Top = 8300
Image1.Visible = False
Image2.Visible = False
Image3.Visible = True
Image4.Visible = False
For j = 11500 To 0 Step -1
rotate
Image3.Move Image3.Left - 1, Image3.Top
Next j
Image3.Left = 11500
Image3.Top = 8300
uGefysLwmvufpJG 228
''''''''''''''
Image4.Left = 0
Image4.Top = 8300
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = True
For j = 8300 To 0 Step -1
rotate
Image4.Move Image4.Left, Image4.Top - 1
Next j
Image4.Left = 0
Image4.Top = 8300
Print: Print: Print " ", k: Beep
Next k
Image1.Left = 0
Image1.Top = 0
Image1.Visible = True
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
End Sub

300/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub

301/ tqdyk g y½d*k &rfukd Run ygu jrm§ ;wpfpif;onf vufsm&pf(10)Burd yf wfaeonf
udk jrifawGU&vdrfhrnf/
---------------0-0-0---------------
229 Microsoft Visual Basic 6.0

Chapter (9)

Access 2002 ½Sd Database File xJrS Table File wpfcktm;zGifhjcif;


1/ atmufyg Form yHpk (H 2)cktm; zefw;D wnfaqmufxm;&rnf/ yH(k 253)? yH(k 254)/

yHk(253)

yHk(254)

2/ yH(k 253)yg Form yHkpHwGif rsm;jzifzh efw;D xm;Ny;D Command


Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

3/ Open File Command Button twGuf-


Private Sub Command1_Click()
Form1.Hide
Form2.Show
End Sub
uGefysLwmvufpJG 230
4/ Exit Command Button twGuf-
Private Sub Command2_Click()
Unload Me
End
End Sub

5/ xdkYaemuf Form2 yHkpHtm;zefwD;wnfaqmufxm;&rnf/ yHk(254)/ 4if;wGif


, , , , rsm;jzifhzefwD;
xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command Button
rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
6/ Label1, 2, 3, 4, 5, 6, 7, 8 wGifyg0ifMuaom Properties rsm;twGuf -
(u) Alignment - 0 - Left Justify
( c) AutoSize - True
( *) BackStyle - 0 - Transparent
(C) BorderStyle - 0 - None
( i) Font - MS Sans Serif, Bold, 8

7/ Text1 - TextBox Properties twGuf -


(u) (Name) - Text1
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Roll Number
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

8/ Text2 - TextBox Properties twGuf -


(u) (Name) - Text2
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Name
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8
231 Microsoft Visual Basic 6.0

9/ Text3 - TextBox Properties twGuf -


(u) (Name) - Text3
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Myanmar
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

10/ Text4 - TextBox Properties twGuf -


(u) (Name) - Text4
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - English
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

11/ Text5 - TextBox Properties twGuf -


(u) (Name) - Text5
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Maths
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

12/ Text6 - TextBox Properties twGuf -


(u) (Name) - Text6
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Total
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8
uGefysLwmvufpJG 232
13/ Text7 - TextBox Properties twGuf -
(u) (Name) - Text7
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Result
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

14/ Text8 - TextBox Properties twGuf -


(u) (Name) - Text8
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Amount of Fail
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

15/ Adodc1 - Adodc Properties twGuf -


(u) (Name) - Adodc1
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn= exam01;
uid=;pwd=;
( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Roll Number], Name,
Myanmar, English, Maths,Total,
Result,[Amount of Fail] from
exam01 order by [Roll Number]

16/ DataGrid1 - DataGrid Properties twGuf -


(u) (Name) - DataGrid1
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - True
(C) AllowArrows - True
( i) AllowDelete - True
233 Microsoft Visual Basic 6.0

( p) AllowUpdate - True
(q) DataSource - Adodc1
( Z) Font - MS Sans Serif, Bold, 8

17/ Form rSxGufoGm;aomtcg Mouse Pointer yHkrSefjyefjzpf&eftwGuf -


Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub

18/ Record Position od&eftwGuf -


Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.Event
ReasonEnum, ByVal pError As ADODB.Error, adStatus As
ADODB.EventStatusEnum, ByVal pRecordset As
ADODB.Recordset)
Adodc1.Caption = "Record: " & CStr(Adodc1.Recordset.
AbsolutePosition)
End Sub

19/ Add Command Button twGuf -


Private Sub Command1_Click()
Adodc1.Recordset.AddNew
End Sub

20/ Update Command Button twGuf -


Private Sub Command2_Click()
Adodc1.Recordset.UpdateBatch adAffectAll
End Sub

21/ Delete Command Button twGuf -


Private Sub Command3_Click()
With Adodc1.Recordset
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
End Sub
uGefysLwmvufpJG 234
22/ Refresh Command Button twGuf -
Private Sub Command4_Click()
Adodc1.Refresh
End Sub

23/ Close Command Button twGuf -


Private Sub Command5_Click()
Form2.Hide
Form1.Show
End Sub

24/ tqdyk g y½d*k &rfukd Run ygu yHk(255)ygtwdkif;jrifawGU&rnfjzpfonf/

yHk(255)

---------------0-0-0---------------
235 Microsoft Visual Basic 6.0

Access 2002 ½Sd Database File wpfcx k rJ S Table File ESpcf t


k m; Updating jyKvyk jf cif;
25/ atmufyg Form yHpk (H 3)cktm; zefw;D wnfaqmufxm;&rnf/ yH(k 256)? yH(k 257)?
yH(k 258)/

yHk(256)

yHk(257)
uGefysLwmvufpJG 236

yHk(258)

26/ yH(k 256)yg Form yHkpHwGif rsm;jzifzh efw;D xm;Ny;D Command


Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

27/ (9)wef;(u)zdkif Command Button twGuf-


Private Sub Command1_Click()
Form1.Hide
Form2.Show
End Sub

28/ (9)wef;(c)zdkif Command Button twGuf-


Private Sub Command1_Click()
Form1.Hide
Form3.Show
End Sub

29/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

30/ xdkYaemuf Form2, Form3 yHkpHtm;zefwD;wnfaqmufxm;&rnf/ yHk(257)?


yHk(258)/ 4if;wGif , , , ,
237 Microsoft Visual Basic 6.0

rsm;jzifh zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Com-


mand Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

31/ Label1, 2, 3, 4, 5, 6, 7, 8 wGifyg0ifMuaom Properties rsm;twGuf -


(u) Alignment - 0 - Left Justify
( c) AutoSize - True
( *) BackStyle - 0 - Transparent
(C) BorderStyle - 0 - None
( i) Font - MS Sans Serif, Bold, 8

32/ Text1 - TextBox Properties twGuf -


(u) (Name) - Text1
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Roll Number
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

33/ Text2 - TextBox Properties twGuf -


(u) (Name) - Text2
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Name
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

34/ Text3 - TextBox Properties twGuf -


(u) (Name) - Text3
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Myanmar
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8
uGefysLwmvufpJG 238
35/ Text4 - TextBox Properties twGuf -
(u) (Name) - Text4
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - English
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

36/ Text5 - TextBox Properties twGuf -


(u) (Name) - Text5
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Maths
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

37/ Text6 - TextBox Properties twGuf -


(u) (Name) - Text6
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Total
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

38/ Text7 - TextBox Properties twGuf -


(u) (Name) - Text7
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Result
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8
239 Microsoft Visual Basic 6.0

39/ Text8 - TextBox Properties twGuf -


(u) (Name) - Text8
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Amount of Fail
( i) DataFormat - General
( p) DataSource - Adodc1
(q) Font - MS Sans Serif, Bold, 8

40/ Adodc1 - Adodc Properties twGuf -


(u) (Name) - Adodc1
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=exam01;
uid=;pwd=;
( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Roll Number], Name,
Myanmar, English, Maths,Total,
Result,[Amount of Fail] from
exam01 order by [Roll Number]
[Form2 twGuf]
( Z) RecordSource - select [Roll Number], Name,
Myanmar, English, Maths,Total,
Result,[Amount of Fail] from
exam02 order by [Roll Number]
[Form3 twGuf]

41/ DataGrid1 - DataGrid Properties twGuf -


(u) (Name) - DataGrid1
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - True
(C) AllowArrows - True
( i) AllowDelete - True
( p) AllowUpdate - True
(q) DataSource - Adodc1
( Z) Font - MS Sans Serif, Bold, 8
uGefysLwmvufpJG 240
42/ Form rSxGufoGm;aomtcg Mouse Pointer yHkrSefjyefjzpf&eftwGuf -
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub

43/ Record Position od&eftwGuf -


Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.Event
ReasonEnum, ByVal pError As ADODB.Error, adStatus As
ADODB.EventStatusEnum, ByVal pRecordset As
ADODB.Recordset)
Adodc1.Caption = "Record: " & CStr(Adodc1.Recordset.
AbsolutePosition)
End Sub

44/ (3)bmomaygif;jcif; Command Button twGuf -


Private Sub Command1_Click()
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
Adodc1.Recordset("Total") = Adodc1.Recordset("Myanmar") +
Adodc1.Recordset("English") + Adodc1.Recordset("Maths")
If Adodc1.Recordset("Myanmar") < 40 Or Adodc1.Recordset
("English") < 40 Or Adodc1.Recordset("Maths") < 40 Then
Adodc1.Recordset("Result") = "Fail"
Else
Adodc1.Recordset("Result") = "Pass"
End If
If Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset
("English") < 40 And Adodc1.Recordset("Maths") < 40 Then
Adodc1.Recordset("Amount of Fail") = "3"
ElseIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset
("English") < 40 And Adodc1.Recordset("Maths") >= 40 Then
Adodc1.Recordset("Amount of Fail") = "2"
ElseIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset
("English") >= 40 And Adodc1.Recordset("Maths") < 40 Then
Adodc1.Recordset("Amount of Fail") = "2"
241 Microsoft Visual Basic 6.0

ElseIf Adodc1.Recordset("Myanmar") >= 40 And Adodc1.Recordset


("English") < 40 And Adodc1.Recordset("Maths") < 40 Then
Adodc1.Recordset("Amount of Fail") = "2"
ElseIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset
("English") >= 40 And Adodc1.Recordset("Maths") >= 40
Then
Adodc1.Recordset("Amount of Fail") = "1"
ElseIf Adodc1.Recordset("Myanmar") >= 40 And Adodc1.Recordset
("English") < 40 And Adodc1.Recordset("Maths") >= 40 Then
Adodc1.Recordset("Amount of Fail") = "1"
ElseIf Adodc1.Recordset("Myanmar") >= 40 And Adodc1.Recordset
("English") >= 40 And Adodc1.Recordset("Maths") < 40 Then
Adodc1.Recordset("Amount of Fail") = "1"
Else
Adodc1.Recordset("Amount of Fail") = Null
End If
Adodc1.Recordset.Update
Adodc1.Recordset.MoveNext
Loop
Adodc1.Recordset.MoveFirst
End Sub

45/ rlvae&modkYjyefoGm;jcif; Command Button twGuf - [Form2 twGuf]


Private Sub Command2_Click()
Form2.Hide
Form1.Show
End Sub

46/ rlvae&modkYjyefoGm;jcif; Command Button twGuf - [Form3 twGuf]


Private Sub Command2_Click()
Form3.Hide
Form1.Show
End Sub
---------------0-0-0---------------
uGefysLwmvufpJG 242
Access 2002 ½Sd Database File wpfcx
k rJ S Table File rsm;tm; Form wpfcjk zifzh iG jhf cif;
47/ atmufyg Form yHkpHtm; zefwD;wnfaqmufxm;&rnf/ yHk(259)/

yHk(259)
48/ yH(k 259)yg Form yHpk w
H iG f , , rsm;jzifh
zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command
Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

49/ a1 - Adodc Properties twGuf -


(u) (Name) - a1
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=exam01;
uid=;pwd=;
( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Roll Number], Name,
Myanmar, English, Maths,Total,
Result,[Amount of Fail] from
exam01 order by [Roll Number]

50/ a2 - Adodc Properties twGuf -


(u) (Name) - a2
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=exam01;
uid=;pwd=;
243 Microsoft Visual Basic 6.0

( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Roll Number], Name,
Myanmar, English, Maths,Total,
Result,[Amount of Fail] from
exam02 order by [Roll Number]

51/ a3 - Adodc Properties twGuf -


(u) (Name) - a3
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=exam01;
uid=;pwd=;
( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Roll Number], Name,
Myanmar, English, Maths,Total,
Result,[Amount of Fail] from
exam03 order by [Roll Number]

52/ DataGrid1 - DataGrid Properties twGuf -


(u) (Name) - DataGrid1
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - True
(C) AllowArrows - True
( i) AllowDelete - True
( p) AllowUpdate - True
(q) Font - MS Sans Serif, Bold, 8

53/ A1 - Adodc \ Record Position twGuf -


Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event
StatusEnum, ByVal pRecordset As ADODB.Recordset)
a1.Caption = "Record: " & CStr(a1.Recordset.AbsolutePosition)
End Sub
uGefysLwmvufpJG 244
54/ A2 - Adodc \ Record Position twGuf -
Private Sub a2_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.
EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
a2.Caption = "Record: " & CStr(a2.Recordset.AbsolutePosition)
End Sub

55/ A3 - Adodc \ Record Position twGuf -


Private Sub a3_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.
EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
a3.Caption = "Record: " & CStr(a3.Recordset.AbsolutePosition)
End Sub

56/ File One Command Button twGuf -


Private Sub Command1_Click()
Set DataGrid1.DataSource = a1
a1.Left = 2880
a1.Top = 4440
a2.Left = 2640
a2.Top = 5760
a3.Left = 5160
a3.Top = 5760
Form1.Height = 5985
Form1.Caption = "Standard 9th, Section (A)"
End Sub

57/ File Two Command Button twGuf -


Private Sub Command2_Click()
Set DataGrid1.DataSource = a2
a1.Left = 120
a1.Top = 5760
a2.Left = 2880
a2.Top = 4440
a3.Left = 5160
a3.Top = 5760
245 Microsoft Visual Basic 6.0

Form1.Height = 5985
Form1.Caption = "Standard 9th, Section (B)"
End Sub

58/ File Three Command Button twGuf -


Private Sub Command3_Click()
Set DataGrid1.DataSource = a3
a1.Left = 120
a1.Top = 5760
a2.Left = 2640
a2.Top = 5760
a3.Left = 2880
a3.Top = 4440
Form1.Height = 5985
Form1.Caption = "Standard 9th, Section (C)"
End Sub

59/ Exit Command Button twGuf -


Private Sub Command4_Click()
Unload Me
End
End Sub

60/ Form Load twGuf -


Private Sub Form_Load()
Form1.Height = 6975
End Sub
---------------0-0-0---------------
uGefysLwmvufpJG 246
Access 2002 ½Sd Database File trsm;pkxr
J S Table File trsm;pktm; Form wpfcjk zifh
zGifhjcif;
61/ atmufyg Form yHkpHtm; zefwD;wnfaqmufxm;&rnf/ yHk(260)/

yHk(260)
62/ yH(k 260)yg Form yHpk w
H iG f , , rsm;jzifh
zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command
Button rsm;wGif vdktyfaomy½dk*&rfrsm; a&;om;&efjzpfygonf/

63/ a1 - Adodc Properties twGuf -


(u) (Name) - a1
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=Test1;
uid=;pwd=;
( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Identification Number],
Rank,Name, Department from
Test1 order by [Identification
Number]

64/ a2 - Adodc Properties twGuf -


(u) (Name) - a2
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=exam02;
uid=;pwd=;
247 Microsoft Visual Basic 6.0

( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Roll Number], Name,
Myanmar, English, Maths,Total,
Result,[Amount of Fail] from
exam02 order by [Roll Number]

65/ a3 - Adodc Properties twGuf -


(u) (Name) - a3
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=exam01;
uid=;pwd=;
( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Roll Number], Name,
Myanmar, English, Maths,Total,
Result,[Amount of Fail] from
exam03 order by [Roll Number]

66/ DataGrid1 - DataGrid Properties twGuf -


(u) (Name) - DataGrid1
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - True
(C) AllowArrows - True
( i) AllowDelete - True
( p) AllowUpdate - True
(q) Font - MS Sans Serif, Bold, 8

67/ A1 - Adodc \ Record Position twGuf -


Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event
StatusEnum, ByVal pRecordset As ADODB.Recordset)
a1.Caption = "Record: " & CStr(a1.Recordset.AbsolutePosition)
End Sub
uGefysLwmvufpJG 248
68/ A2 - Adodc \ Record Position twGuf -
Private Sub a2_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.
EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
a2.Caption = "Record: " & CStr(a2.Recordset.AbsolutePosition)
End Sub

69/ A3 - Adodc \ Record Position twGuf -


Private Sub a3_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event
StatusEnum, ByVal pRecordset As ADODB.Recordset)
a3.Caption = "Record: " & CStr(a3.Recordset.AbsolutePosition)
End Sub

70/ File One Command Button twGuf -


Private Sub Command1_Click()
Set DataGrid1.DataSource = a1
a1.Left = 2880
a1.Top = 4440
a2.Left = 2640
a2.Top = 5760
a3.Left = 5160
a3.Top = 5760
Form1.Height = 5985
Form1.Caption = "Economic File (Table File) from Test1.mdb"
End Sub

71/ File Two Command Button twGuf -


Private Sub Command2_Click()
Set DataGrid1.DataSource = a2
a1.Left = 120
a1.Top = 5760
a2.Left = 2880
a2.Top = 4440
a3.Left = 5160
a3.Top = 5760
249 Microsoft Visual Basic 6.0

Form1.Height = 5985
Form1.Caption = "Standard 9th, Section (B) (Table File) from
exam02.mdb"
End Sub

72/ File Three Command Button twGuf -


Private Sub Command3_Click()
Set DataGrid1.DataSource = a3
a1.Left = 120
a1.Top = 5760
a2.Left = 2640
a2.Top = 5760
a3.Left = 2880
a3.Top = 4440
Form1.Height = 5985
Form1.Caption = "Standard 9th, Section (C) (Table File) from
exam01.mdb"
End Sub

73/ Exit Command Button twGuf -


Private Sub Command4_Click()
Unload Me
End
End Sub

74/ Form Load twGuf -


Private Sub Form_Load()
Form1.Height = 6975
End Sub

75/ tqdyk g y½d*k &rfukd Run ygu yHk(261)? (262)? (263)ygtwdkif;jrifawGU&rnf/


uGefysLwmvufpJG 250

yHk(261)

yHk(262)
251 Microsoft Visual Basic 6.0

yHk(263)

---------------0-0-0---------------
uGefysLwmvufpJG 252
Access 2002 ½Sd Database File twGif;rS Table File rsm;tm; Form wpfckjzifh
Append jyKvkyfjcif;
76/ atmufyg Form yHkpHtm; zefwD;wnfaqmufxm;&rnf/ yHk(264)/

yHk(264)

77/ yH(k 264)yg Form yHpk w


H iG f , , rsm;jzifh
zefwD;xm;NyD; oufqdkif&m Properties rsm;wGif jyifqifjznfhpGufNyD;aemuf Command
Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

78/ a1 - Adodc Properties twGuf -


(u) (Name) - a1
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=exam01;
uid=;pwd=;
( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Identification Number],
Rank,Name, Department from
Test1 order by [Identification
Number]

79/ a2 - Adodc Properties twGuf -


(u) (Name) - a2
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=exam02;
uid=;pwd=;
253 Microsoft Visual Basic 6.0

( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Roll Number], Name,
Myanmar, English, Maths,Total,
Result,[Amount of Fail] from
Test1 order by [Roll Number]

80/ DataGrid1 - DataGrid Properties twGuf -


(u) (Name) - DataGrid1
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - False
(C) AllowArrows - False
( i) AllowDelete - False
( p) AllowUpdate - False
(q) Font - MS Sans Serif, Bold, 8
( Z) DataSource - a1

81/ DataGrid2 - DataGrid Properties twGuf -


(u) (Name) - DataGrid2
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - True
(C) AllowArrows - True
( i) AllowDelete - True
( p) AllowUpdate - True
(q) Font - MS Sans Serif, Bold, 8
( Z) DataSource - a2

82/ A1 - Adodc \ Record Position twGuf -


Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event
StatusEnum, ByVal pRecordset As ADODB.Recordset)
a1.Caption = "Record: " & CStr(a1.Recordset.AbsolutePosition)
End Sub
uGefysLwmvufpJG 254
83/ A2 - Adodc \ Record Position twGuf -
Private Sub a2_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.
EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
a2.Caption = "Record: " & CStr(a2.Recordset.AbsolutePosition)
End Sub

84/ To Append Table File Button twGuf -


Private Sub Command1_Click()
Set DataGrid1.DataSource = a1
a1.Recordset.MoveFirst
Do While a1.Recordset.EOF = False
a2.Recordset.AddNew
z01 = a1.Recordset("Identification Number")
z02 = a1.Recordset("Rank")
z03 = a1.Recordset("Name")
z04 = a1.Recordset("Department")
a2.Recordset("Identification Number") = z01
a2.Recordset("Rank") = z02
a2.Recordset("Name") = z03
a2.Recordset("Department") = z04
a1.Recordset.MoveNext
a2.Recordset.Update
Loop
a1.Recordset.MoveFirst
a1.Refresh
a2.Recordset.MoveFirst
a2.Refresh
Form1.Caption = "To add Test1 Table File from Exam02 Database File"
End Sub

85/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
255 Microsoft Visual Basic 6.0

Access 2002 ½Sd Database File twGif;rS Table File twGif;½Sd Record tm;½Smjcif;
86/ atmufyg Form yHkpHtm; zefwD;wnfaqmufxm;&rnf/ yHk(265)/

yHk(265)
87/ yH(k 265)yg Form yHkpHwGif , , , ,
rsm;jzifh zefw;D xm;Ny;D oufqikd &f m Properties rsm;wGijf yifqifjznfph u
G f
NyD;aemuf Command Button rsm;wGifvdktyfaom y½dk*&rfrsm;a&;om;&efjzpfygonf/
88/ a1 - Adodc Properties twGuf -
(u) (Name) - a1
( c) Align - 0 - vbAlignNone
( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn=exam02;
uid=;pwd=;
( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [Identification Number],
Rank, Name, Department from
Test1 order by [Identification
Number]

89/ DataGrid1 - DataGrid Properties twGuf -


(u) (Name) - DataGrid1
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - True
(C) AllowArrows - True
( i) AllowDelete - True
uGefysLwmvufpJG 256
( p) AllowUpdate - True
(q) Font - MS Sans Serif, Bold, 8
( Z) DataSource - a1

90/ A1 - Adodc \ Record Position twGuf -


Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event
StatusEnum, ByVal pRecordset As ADODB.Recordset)
a1.Caption = "Record: " & CStr(a1.Recordset.AbsolutePosition)
End Sub

91/ To Find Command Button twGuf -


Private Sub Command1_Click()
Set DataGrid1.DataSource = a1
z1 = Text1
a1.Recordset.MoveFirst
Do While a1.Recordset.EOF = False
If a1.Recordset("Identification Number") = z1 Then
Cls:Print
Print a1.Recordset("Identification Number"), a1.Recordset
("Rank"),a1.Recordset("Name"), a1.Recordset
("Department")
Exit Do
Else
Cls
Print
Print "Not Fount"
End If
a1.Recordset.MoveNext
Loop
End Sub

92/ Exit Command Button twGuf -


Private Sub Command2_Click()
Unload Me
End
End Sub
257 Microsoft Visual Basic 6.0

93/ wpfzufyg Program udk Run yguatmufygtwdkif;jrifawGU&rnf/ yHk(266)/

yHk(266)

---------------0-0-0---------------
uGefysLwmvufpJG 258

Chapter (10)

Microsoft Visual 6.0 jzifh,cifoHk; Access zdkifwnfaqmufjcif;


1/ yxrOD;pGm Microsoft Visual 6.0 udzk iG yhf g/ xdaYk emuf yH(k 267)yg Form1
wGif Command Button udkoHk;í atmufygtwdkif;zefwD;&rnf/ Command Button
rsm;wGif oufqdkif&m y½dk*&rfrsm;a&;om;&rnf/

yHk(267)

2/ Open Database Command Button twGuf-


Private Sub Command1_Click()
Form1.Hide
frmForm2.Show
End Sub

3/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

4/ Menu Bar ½Sd Add-Ins udka½G;yg/ tay:qHk; Pulldown Menu wpfcjk zpfonfh
Visual Data Manager udak ½G;yg/ yH(k 268)/

yHk(268)

5/ xdt
k cg VisData Window Dialog Box wpfckay:vmrnf/ yHk(269)/
259 Microsoft Visual Basic 6.0

yHk(269)

6/ 4if; Window xJrS Menu Bar wpfckjzpfonfh File udka½G;cs,f&efjzpfonf/


New... udkxyfrHa½G;ygu Visual Basic 6.0 rSwnfaqmufEdkifonfh atmufygzdkifrsm;
ay:vmayrnf/ yHk(270)/

yHk
(270)

7/ yH(k 270)yg yHrk S Microsoft Access 4udka½G;cs,f&rnf/ xdktcg Version


2.0 MDB... ESifh Version 7.0 MDB... wdkYay:vmayrnf/ yHk(271)/

yHk(271)
8/ 4if;rS Version 7.0 udak ½G;cs,&f rnf/ xdt
k cgzdik o
f pfwnfaqmuf&ef zdik t
f rnf
uGefysLwmvufpJG 260
topfawmif;onfh Dialog Box ay:vmrnf/ yH(k 272)/

yHk(272)

9/ yHk(272)wGif zdkiftrnfay;NyD; Save udak ½G;cs,yf g/ Oyrm/ Test01/ xdt


k cg
Database Window ay:vmrnf/ yH(k 273)/

yHk(273)

10/ yH(k 273)yg Database Window Dialog Box wGifyg0ifaom Properties


udka½G;NyD; Right Click ESyd yf g/ xdt
k cg Short Cut Menu wpfckyHk(274)ygtwdkif;ay:
vmrnf/

yHk(274)

11/ Short Cut Menu rS New Table udka½G;cs,f&rnf/ xdktcg Table Struc-
261 Microsoft Visual Basic 6.0

ture Dialog Box ay:vmrnf/ yH(k 275)/

yHk(275)

12/ Table Name: List Box wGif Table File Name udr k rd pd w
d Bf uKu
d jf znfph u
G yf g/
Oyrm/ Test01 [k owfrSwfNyD; Add Field Command Button udka½G;cs,f&rnf/ xdktcg
Add Field Dialog Box ay:vmrnf/ 4if;wGif Field Name, Field Type, Field
Size wdkYudk pdwfBuKdufjznfhpGufNyD;aemuf OK udk Click jyKvy
k yf g/ yH(k 276)/

yHk(276)

13/ xdkaemuf Add Field Dialog Box xyfrHay:vmNyD; rdrdBuKdwifpDrHxm;aom


Field Name, Field Type, Field Size rsm;udkowfrSwfNyD; OK udka½G;cs,f&rnf/ Field
tm;vH;k owfrw
S Nf y;D ygu Close Command Button udak ½G;cs,yf g/ yH(k 277)/
uGefysLwmvufpJG 262

yHk(277)

14/ xdktcg yHk(278)ygtwdkif;jrifawGU&rnf/

15/ Field Type wGifatmufyg vkyHyk(278)


fydkifcGifhtcsufrsm;yg0ifonf -
263 Microsoft Visual Basic 6.0

(u) Boolean /
( c) Byte/
( *) Integer/
(C) Long/
( i) Currency/
( p) Single/
(q) Double/
( Z) Date/Time /
( ps) Text /
(n) Binary/
( #) Memo /

16/ Field rsm;ay:wGifrlwnfNyD; Index jyKvy


k v
f ykd gu Add Index udak ½G;cs,yf g/
Add Index to Test01 Dialog Box ay:vmygu Name List Box wGif trnfowfrw S f
yg/ Index Fields tm;rdrdowfrSwfvdkonfh Field Name udk Available Fields wGif
Double Click jyKvkyfjcif;jzifhwnfaqmufEdkifayonf/ xdkYaemuf OK udok wfrw S &f rnf/
yH(k 279)/

yHk(279)

17/ yHk(279)wGif OK udo


k wfrw
S v
f u
kd yf gu Table Structure Dialog Box ay:
vmrnf/ yH(k 280)/
uGefysLwmvufpJG 264

18/ yHk(280)wGif Close CommandyHk(280)


Button udak ½G;cs,yf gu rdrw
d nfaqmufxm;
aom Table File qHk;½IH;oGm;Edkifonf/ xdkYaMumifh Build the Table Command Button
udka½G;cs,f&rnf/ xdktcg yHk(281)yg twdkif; Database Window Dialog Box wpfck
jyefvnfay:vmayrnf/

19/ xdkYaemuf Utility Menu rS yHData


k(281)Form Designer... udak ½G;yg/ yH(k 282)/
265 Microsoft Visual Basic 6.0

yHk(282)

20/ xdt
k cg yH(k 283)ygtwdik ;f Data Form Designer Dialog Box ay:vmrnf/

yHk(283)

21/ Form Name [w/o Extension]: List Box wGir f rd o


d wfrw
S v
f o
kd nfh trnfukd
jznfph u
G yf g/ Oyrm - Form2 [kjznfph u
G Nf y;D RecordSource: List Box wGif Dropdown
List Arrow udk Mouse jzif h Click jyKvkyfyg/ xdktcg Pulldown Menu xJrS
rdrdzefwD;xm; onfh Table File tm;a½G;cs,fygu yHk(284)ygtwdkif;jzpfay:vmrnf/
uGefysLwmvufpJG 266

yHk(284)

22/ yHk(284)wGif Available Fields: xJrS rdrdtvdk½Sdonfh Field rsm;tm; In-


cluded Fields: List Box xJodkY > or >> jzify
h yYkd g/ Oyrm - Fields tm;vH;k udak ½G;cs,yf g/
yHk(285)twdkif; jrifawGU&rnf/

yHk(285)

23/ xdkYaemuf Build the Form Command Button tm;a½G;cs,fyg/ qufvufí


Close Command Button udka½G;cs,f&rnf/ xdktcg Data Entry jyKvkyf&ef Form
wpfck&½Sdvmayrnf/ yHk(286)/
267 Microsoft Visual Basic 6.0

yHk(286)

24/ yH(k 286)yg Form yHkpHtm; yHk(287)ygtwdkif;odrf;qnf;&rnf/

yHk(287)

25/ Form2 wGifyg0ifaom Toolbox Icon rsm;udkavhvmygu Label,

Text Box, Command Button, Data wdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udk


jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;
&rnfjzpfonf/
26/ lblLabels(0) - Label Properties rSm -
(u) (Name) - lblLabels
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - Opaque
uGefysLwmvufpJG 268
( i) Caption - LabourID:
( p) DataFormat - General
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 0
( ps) WordWrap - False

27/ lblLabels(1) - Label Properties rSm -


(u) (Name) - lblLabels
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - Opaque
( i) Caption - Name:
( p) DataFormat - General
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 1
( ps) WordWrap - False

28/ lblLabels(2) - Label Properties rSm -


(u) (Name) - lblLabels
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - Opaque
( i) Caption - Date of Birth:
( p) DataFormat - General
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 2
( ps) WordWrap - False

29/ lblLabels(3) - Label Properties rSm -


(u) (Name) - lblLabels
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
269 Microsoft Visual Basic 6.0

(C) BackStyle - Opaque


( i) Caption - Salary:
( p) DataFormat - General
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 3
( ps) WordWrap - False

30/ txtFields(0) - Text Properties rSm -


(u) (Name) - txtFields
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) DataField - LabourID
( i) DataFormat - General
( p) DataSource - Data1
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 0
( ps) MultiLine - False

31/ txtFields(1) - Text Properties rSm -


(u) (Name) - txtFields
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) DataField - Name
( i) DataFormat - General
( p) DataSource - Data1
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 1
( ps) MultiLine - False

32/ txtFields(2) - Text Properties rSm -


(u) (Name) - txtFields
( c) Alignment - 0 - Left Justify
uGefysLwmvufpJG 270
( *) BorderStyle- 1 - Fixed Single
(C) DataField - Date of Birth
( i) DataFormat - General
( p) DataSource - Data1
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 2
( ps) MultiLine - False

33/ txtFields(3) - Text Properties rSm -


(u) (Name) - txtFields
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) DataField - Salary
( i) DataFormat - General
( p) DataSource - Data1
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 3
( ps) MultiLine - False

34/ Data1 - Data Properties rSm-


(u) (Name) - Data1
( c) Align - 2 - Align Bottom
( *) BOFAction - 0 - Move First
(C) DatabaseName - C:\Program Files\Microsoft
VisualStudio\VB98\Test01.mdb
( i) EOFAction - 0 - Move Last
( p) ReadOnly - False
(q) RecordsetType - 1 - Dynaset
( Z) RecordSource - Test01

35/ cmdAdd - Command Button Properties rSm -


271 Microsoft Visual Basic 6.0

(u) (Name) - cmdAdd


( c) Caption - &Add
( *) Font - MS Sans Serif, Regular, 8

36/ cmdDelete - Command Button Properties rSm -


(u) (Name) - cmdDelete
( c) Caption - &Delete
( *) Font - MS Sans Serif, Regular, 8

37/ cmdRefresh - Command Button Properties rSm-


(u) (Name) - cmdRefresh
( c) Caption - &Refresh
( *) Font - MS Sans Serif, Regular, 8

38/ cmdUpdate - Command Button Properties rSm -


(u) (Name) - cmdUpdate
( c) Caption - &Update
( *) Font - MS Sans Serif, Regular, 8

39/ cmdClose - Command Button Properties rSm -


(u) (Name) - cmdClose
( c) Caption - &Close
( *) Font - MS Sans Serif, Regular, 8

40/ Add Command Button twGuf -


Private Sub cmdAdd_Click()
Data1.Recordset.AddNew
End Sub

41/ Delete Command Button twGuf -


Private Sub cmdDelete_Click()
'this may produce an error if you delete the last
'record or the only record in the recordset
Data1.Recordset.Delete
uGefysLwmvufpJG 272
Data1.Recordset.MoveNext
End Sub

42/ Refresh Command Button twGuf -


Private Sub cmdRefresh_Click()
'this is really only needed for multi user apps
Data1.Refresh
End Sub

43/ Update Command Button twGuf -


Private Sub cmdUpdate_Click()
Data1.UpdateRecord
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
End Sub

44/ Close Command Button twGuf -


Private Sub cmdClose_Click()
frmForm2.Hide
Form1.Show
End Sub

45/ Error twGuf -


Private Sub Data1_Error(DataErr As Integer, Response As Integer)
'This is where you would put error handling code
'If you want to ignore errors, comment out the next line
'If you want to trap them, add code here to handle them
MsgBox "Data error event hit err:" & Error$(DataErr)
Response = 0 'throw away the error
End Sub

46/ Record Position twGuf-


Private Sub Data1_Reposition()
Screen.MousePointer = vbDefault
On Error Resume Next
'This will display the current record position
273 Microsoft Visual Basic 6.0

'for dynasets and snapshots


Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
'for the table object you must set the index property when
'the recordset gets created and use the following line
'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount *
(Data1.Recordset.PercentPosition * 0.01)) + 1
End Sub

47/ Data1 Validate twGuf-


Private Sub Data1_Validate(Action As Integer, Save As Integer)
'This is where you put validation code
'This event gets called when the following actions occur
Select Case Action
Case vbDataActionMoveFirst
Case vbDataActionMovePrevious
Case vbDataActionMoveNext
Case vbDataActionMoveLast
Case vbDataActionAddNew
Case vbDataActionUpdate
Case vbDataActionDelete
Case vbDataActionFind
Case vbDataActionBookmark
Case vbDataActionClose
End Select
Screen.MousePointer = vbHourglass
End Sub

----------0-0-0----------

,cifoHk; Access zdkifudk Data Report wnfaqmufí Report wnfaqmufjcif;


uGefysLwmvufpJG 274
48/ yxrOD;pGm Microsoft Visual 6.0 udzk iG yhf g/ xdaYk emuf yH(k 288)yg Form1
wGif Command Button udkoHk;í atmufygtwdkif;zefwD;&rnf/

yHk(288)

49/ xdkYaemuf Menu Bar ½Sd Project udka½G;yg/ xdkYaemuf Pulldown Menu
xJrS Add Data Report udkxyfrHa½G;cs,f&rnf/ yHk(289)/

yHk(289)

50/ yHk(290)ygtwdkif; Project1 - DataReport1 [DataReport] Form ay:


275 Microsoft Visual Basic 6.0

vmayrnf/

yHk(290)

51/ txufyg Report Form yHpk t


H m;zefw;D vdu
k o
f nfEiS hf Project Explorer wGif
vnf; yHk(291)ygtwdkif; DataReport1(DataReport1) topfwpfckwdk;vmayrnf/

yHk(291)

52/ txufyg Report Form yHpk t


H m;trnfajymif;vJ&ayrnf/ Properties - Data
Report1 wGif Name ü RDataReport1 [kajymif;vJowfrw S yf g/ yH(k 292)/
uGefysLwmvufpJG 276

yHk(292)

53/ Project Explorer wG i f v nf ; yH k ( 293)ygtwd k i f ; RDataReport1


(DataReport1) [ktrnfajymif;oGm;ayrnf/

yHk(292)

54/ tqdyk g RDataReport1(RDataReport1) File udo k rd ;f vdyk gu Menu Bar


½Sd File udka½G;cs,fyg/ xdkYaemuf Save Project udkxyfrHa½G;cs,fygu Save File As
Dialog Box ay:vmrnf/ Save Command Button udka½G;cs,f&rnf/ yHk(293)/
277 Microsoft Visual Basic 6.0

yHk(293)

55/ xyfrHí Menu Bar jzpfaom Project rS More ActiveX Designers... udk
a½G;cs,&f rnf/ xdtk cg Data Environment qdo
k nfh Sub-Menu wpfcx
k yfraH y:vmrnf/
4if;udkxyfrHa½G;cs,fyg/ yHk(294)/

yHk(294)

56/ xdktcg yHk(295)wGifazmfjyxm;aom Project1 - DataEnvironment1


uGefysLwmvufpJG 278
[DataEnvironment] Dialog Box ay:vmayrnf/ 4if;udktrnfajymif;&ef Proper-
ties udka½G;í Properties-DataEnvironment wGif Name RDataEnvironment1 [k
ajymif;vJowfrSwf&rnf/ yHk(296)/

yHk(295)

yHk(296)

57/ Project Explorer wG i f v nf ; yH k ( 297)ygtwd k i f ; RDataReport1


(DataReport1) [ktrnfajymif;oGm;ayrnf/
279 Microsoft Visual Basic 6.0

yHk(297)

58/ xdak emuf Project1 - RDataEnvironment [DataEnvironment] wGif Con-


nection1 udka½G;í Right Click udE
k ydS yf g/ Short Cut Menu ay:vmygu yHk(298)wGif
azmfjyxm;onfhtwdkif; Properties... udk xyfrHa½G;cs,fyg/

yHk(298)

59/ xdt
k cg Data Link Properties Dialog Box ay:vmrnf/ 4if;rS Provider
uGefysLwmvufpJG 280
Tab Command Button udka½G;í Microsoft Jet 3.51 OLE DB Provider udka½G;cs,f
yg/ yH(k 299)/

yHk(299)

60/ xdkYaemuf Connection Tab Command Button udak ½G;cs,yf g/ yH(k 300)yg
twdkif; 1. Select or enter a database name: List Box wGif Database File Name
awmif;ygu rdrdudk,fwdkif Database File Name ½dkufxnfhjcif;jzifhvnf;aumif;? udk
xyfrHa½G;cs,fjcif;jzifhvnf;aumif; tvdk½Sdaom Database File Name udka½G;cs,fyg/
yH(k 301)/
281 Microsoft Visual Basic 6.0

yHk(300)

yHk(301)

61/ Test Connection udka½G;cs,fygu rdrda½G;cs,fcJhaom Database File ESifh


Path vrf;aMumif;rSefuefygu yHk(302)ygtwdkif;azmfjyrnfjzpfonf/

yHk(302)

62/ xdkenf;wl Data Link Properties Dialog Box \ Tab Command But-
uGefysLwmvufpJG 282
ton rsm;jzpfMuaom Advanced yH(k 303) ESihf All yH(k 304)wdw
Yk iG rf nfonft
h csurf Q ajymif;vJ
&efrvdkbJ OK udka½G;cs,f&efjzpfygonf/

yHk(303)

yHk(304)

63/ xdak emuf Project1 - RDataEnvironment [DataEnvironment] wGif Con-


283 Microsoft Visual Basic 6.0

nection1 udka½G;í Right Click udE


k ydS yf g/ Short Cut Menu ay:vmygu yHk(305)wGif
azmfjyxm;onfhtwdkif; Add Command udk xyfrHa½G;cs,fyg/

yHk(305)

64/ xdktcg yHk(306)ygtwdkif; jzpfay:vmrnf/

yHk(306)

65/ tqdyk g RDataEnvironment1(RDataEnvironment1) File udo


k rd ;f vdyk gu
uGefysLwmvufpJG 284
Menu Bar ½Sd File udka½G;cs,fyg/ xdkYaemuf Save Project udkxyfrHa½G;cs,fygu Save
File As Dialog Box ay:vmrnf/ Save Command Button udak ½G;cs,& f rnf/ yH(k 307)/

yHk(307)

66/ Project Explorer jzpfonfh Project-Project1 Dialog Box wGifvnf;


RDataEnvironment1(RDataEnvironment1) tpm; RDataEnvironment1
(RDataEnvironment1.Dsr) tjzpfajymif;vJoGm;rnf/ yHk(308)/

yHk(308)

67/ Project1 - RDataEnvironment [DataEnvironment] wGif Connection1


285 Microsoft Visual Basic 6.0

udka½G;í Right Click udEk ydS yf g/ Short Cut Menu ay:vmygu yHk(309)wGifazmfjyxm;
onfhtwdkif; Properties udk xyfrHa½G;cs,fyg/

yHk(309)

68/ xdt
k cg Command1 Properties Dialog Box wpfckay:vmrnf/ 4if;wGif
General, Parameters, Relation, Grouping, Aggregates, Advanced qdkonfh Tab
Command Button (6)ckay:vmrnf/ 4if; Tab Command rsm;xJrS General Tab
Command uda k ½G;yg/ yH(k 310)/
uGefysLwmvufpJG 286

yHk(310)

69/ Source of Data acgif;pOfatmufwGif½Sdaom Database Object: List Box


Dropdown Arrow udka½G;í Table udkajymif;yg/ Object Name: List Box wGif
Dropdown Arrow tultnDjzifrh rd zd efw;D xm;cJah om Test01 udak ½G;cs,&f rnf/ yH(k 311)/

yHk(311)

70/ usef Tab Command Button rsm;tm;jyKjyifp&mrvdak wmhonft h wGuf Apply


-> OK uda
k ½G;cs,yf g/ xdt
k cg Project1 - DataEnvironment1 [DataEnvironment]
Dialog Box ½Sd \ udka½G;ygu yHk(312)wGif azmfjyxm;ouJhodkY Field
Name rsm;azmfjyaeayrnf/
287 Microsoft Visual Basic 6.0

yHk(312)

71/ xdaYk emuf Project1 - RDataReport1 [DataReport] udjk yefvnfqw


GJ if&rnf/
yH(k 313)/

yHk(313)

72/ Page Header (Section2) Activate jzpfaeaomtcg Right Click udE


k ydS yf g/
Short Cut Sub-Menu wpfckay:vmrnf/ 4if;rS Insert Control udka½G;NyD; Label
udkxyfrH a½G;cs,f&rnf/ yHk(314)/
uGefysLwmvufpJG 288

yHk(314)
73/ xdktcg yHk(315)ygtwdkif;jzpfay:vmrnf/

yHk(315)

74/ xdkenf;twdkif; Label (4)ckzefwD;NyD; Labour ID, Name, Date of Birth,


289 Microsoft Visual Basic 6.0

Salary ponfjzifhtrnfowfrSwfyg/ yHk(316)? yHk(317)/

yHk(316)

yHk(317)
75/ Detail (Section1) Activate jzpfaeaomtcg Right Click udE k ydS yf g/ Short
Cut Sub-Menu wpfckay:vmrnf/ 4if;rS Insert Control udka½G;NyD; TextBox udkxyfrH
a½G;cs,f&rnf/ yHk(318)/
uGefysLwmvufpJG 290

yHk(318)
76/ xdktcg yHk(319)ygtwdkif;jzpfay:vmrnf/
291 Microsoft Visual Basic 6.0

yHk(319)
77/ xdkenf;twdkif; TextBox (4)ckzefw;D &rnf/ yH(k 320)/

yHk(320)
78/ Project1 - RDataReport1 [DataReport] Activate jzpfaeaomtcg
Smart Icon jzpfaom \tultnDjzifh yHk(321)wGifazmfjyxm;onfhtwdkif; Prop-
erties - RDataReport1 ü DataSource wGif List Dropdown Arrow jzifh RData
Environment1 udka½G;cs,f&rnf/ DataMember wGif List Dropdown Arrow jzifh
Command1 udkxyfrHa½G;cs,f&rnf/
uGefysLwmvufpJG 292

yHk(321)

79/ Detail (Section1) Activate jzpfap&efjyKvy


k í
f yxrOD;qH;k jrifawGUae&onfh
Text Box uda
k ½G;yg/ Smart Icon jzpfaom \tultnDjzifh yHk(322)wGifazmfjyxm;
onfhtwdkif; Properties - Text1 ü DataMember \ List Dropdown Arrow jzifh
Command1 udkvnf;aumif;? DataField \ List Dropdown Arrow jzifh LabourID
ud k v nf ; aumif ; a½G ; cs,f & rnf / xd k e nf ; wl u sef Text Box toD ; oD ; ud k v nf ;
DataMember, DataField wdkYudkqDavsmfatmifjyKvkyf&rnf/ yHk(323)/
293 Microsoft Visual Basic 6.0

yHk(322)

yHk(323)
uGefysLwmvufpJG 294

yHk(324)

80/ txufyg yHk(324)udkjyefoGm;NyD; oufqdkif&m Command Button rsm;wGif


atmufazmfjyyg yHk(325)ygtwdkif; Coding rsm;udka&;&rnf/

yHk(325)

rSwcf su/f / DataReport toH;k jyKygu DataEnvironment udkoHk;&rnf jzpfonf/


DataEnvironment wGif Database File rwlny D gu Connection1, Connection2,
... [lí cJGjcm;toHk;jyKEdkifNyD; Database File wlnDNyD; Table File (rwlnDvQif) rsm;jym;
aeygu Command1, Command2, ... zefw;D ítoH;k jyKEikd yf gonf/

----------0-0-0----------
uGefysLwmvufpJG 295

,cifoHk; Access zdkifudk Form wnfaqmufí"gwfyHkrsm;Munfhjcif;


81/ yxrOD;pGm Microsoft Visual 6.0 udzk iG yhf g/ xdaYk emuf yH(k 326)yg Form1
wGif Command Button rsm;udkoHk;í atmufygtwdkif;zefwD;NyD; vdktyfaomy½dk*&rfrsm;
a&;om;&rnf/

yHk(326)

82/ Data Entry Command Button twGuf-


Private Sub Command1_Click()
frmForm2.Show
End Sub

83/ Exit Command Button twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

84/ xdkYaemuf yHk(327)yg frmForm2 wGifvdktyfaom Label, TextBox, OLE,


Data, Command Button rsm;udo k ;kH &rnf/ vdt
k yfaom Properties rsm;udv
k nf;jyifqif&
rnf/
uGefysLwmvufpJG 296

yHk(327)

OLE Data

85/ lblLabels(0) - lblLabels Properties twGuf-


(u) (Name) - lblLabels
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - 1 - Opaque
( i) Caption - LabourID:
( p) Font - MS Sans Serif, Regular, 8
(q) Index - 0
( Z) WordWrap - False

86/ lblLabels(1) - lblLabels Properties twGuf-


(u) (Name) - lblLabels
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - 1 - Opaque
( i) Caption - Name:
( p) Font - MS Sans Serif, Regular, 8
(q) Index - 1
( Z) WordWrap - False
297 Microsoft Visual Basic 6.0

87/ lblLabels(2) - lblLabels Properties twGuf-


(u) (Name) - lblLabels
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - 1 - Opaque
( i) Caption - Date of Birth:
( p) Font - MS Sans Serif, Regular, 8
(q) Index - 2
( Z) WordWrap - False

88/ lblLabels(3) - lblLabels Properties twGuf-


(u) (Name) - lblLabels
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - 1 - Opaque
( i) Caption - Salary:
( p) Font - MS Sans Serif, Regular, 8
(q) Index - 1
( Z) WordWrap - False

89/ lblLabels(4) - lblLabels Properties twGuf-


(u) (Name) - lblLabels
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - 1 - Opaque
( i) Caption - Photos:
( p) Font - MS Sans Serif, Regular, 8
(q) Index - 1
( Z) WordWrap - False

90/ txtFields(0) - txtFields Properties twGuf-


(u) (Name) - txtFields
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - LabourID
( i) DataFormat - General
( p) DataSource - Data1
uGefysLwmvufpJG 298
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 0
( ps) MultiLine - False

91/ txtFields(1) - txtFields Properties twGuf-


(u) (Name) - txtFields
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Name
( i) DataFormat - General
( p) DataSource - Data1
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 1
( ps) MultiLine - False

92/ txtFields(2) - txtFields Properties twGuf-


(u) (Name) - txtFields
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Date of Birth
( i) DataFormat - General
( p) DataSource - Data1
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 2
( ps) MultiLine - False

93/ txtFields(3) - txtFields Properties twGuf-


(u) (Name) - txtFields
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) DataField - Salary
( i) DataFormat - General
( p) Font - MS Sans Serif, Regular, 8
(q) Index - 3
( Z) MultiLine - False
299 Microsoft Visual Basic 6.0

94/ oleFields(0) - oleFields Properties twGuf-


(u) (Name) - oleFields
( c) AutoActivate - 2 - DoubleClick
( *) BackStyle - 1 - Opaque
(C) BorderStyle - 1 - Fixed Single
( i) DataField - Photos
( p) DataSource - Data1
(q) Font - MS Sans Serif, Regular, 8
( Z) Index - 0
( ps) OLEDropAllowed - False
(n) OLETypeAllowed - 2 - Either
( #) SizeMode - Stretch

95/ cmdAdd - Command Button Properties rSm -


(u) (Name) - cmdAdd
( c) Caption - &Add
( *) Font - MS Sans Serif, Regular, 8

96/ cmdDelete - Command Button Properties rSm -


(u) (Name) - cmdDelete
( c) Caption - &Delete
( *) Font - MS Sans Serif, Regular, 8

97/ cmdRefresh - Command Button Properties rSm -


(u) (Name) - cmdRefresh
( c) Caption - &Refresh
( *) Font - MS Sans Serif, Regular, 8

98/ cmdUpdate - Command Button Properties rSm -


(u) (Name) - cmdUpdate
( c) Caption - &Update
( *) Font - MS Sans Serif, Regular, 8

99/ cmdClose - Command Button Properties rSm -


(u) (Name) - cmdClose
( c) Caption - &Close
( *) Font - MS Sans Serif, Regular, 8
uGefysLwmvufpJG 300

100/ Data1 - Data Properties rSm -


(u) (Name) - Data1
( c) Align - 0 - None
( *) BOFAction - 0 - Move First
(C) Connect - Access
( i) DatabaseName - C:\Program Files\Microsoft Visual
Studio\VB98\Test01.mdb
( p) EOFAction - 0 - Move Last
(q) Font - MS Sans Serif, Regular, 8
( Z) ReadOnly - False
( ps) RecordsetType - 1 - Dynaset
(n) RecordSource - Test01

101/ Add Command Button twGuf -


Private Sub cmdAdd_Click()
Data1.Recordset.AddNew
End Sub

102/ Delete Command Button twGuf -


Private Sub cmdDelete_Click()
'this may produce an error if you delete the last
'record or the only record in the recordset
Data1.Recordset.Delete
Data1.Recordset.MoveNext
End Sub

103/ Refresh Command Button twGuf -


Private Sub cmdRefresh_Click()
'this is really only needed for multi user apps
Data1.Refresh
End Sub

104/ Update Command Button twGuf -


Private Sub cmdUpdate_Click()
Data1.UpdateRecord
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
End Sub
301 Microsoft Visual Basic 6.0

105/ Close Command Button twGuf -


Private Sub cmdClose_Click()
frmForm2.Hide
Form1.Show
End Sub

106/ Error twGuf -


Private Sub Data1_Error(DataErr As Integer, Response As Integer)
'This is where you would put error handling code
'If you want to ignore errors, comment out the next line
'If you want to trap them, add code here to handle them
MsgBox "Data error event hit err:" & Error$(DataErr)
Response = 0 'throw away the error
End Sub

107/ Record Position twGuf-


Private Sub Data1_Reposition()
Screen.MousePointer = vbDefault
On Error Resume Next
'This will display the current record position
'for dynasets and snapshots
Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
'for the table object you must set the index property when
'the recordset gets created and use the following line
'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount *
(Data1.Recordset.PercentPosition * 0.01)) + 1
End Sub

108/ Data1 Validate twGuf-


Private Sub Data1_Validate(Action As Integer, Save As Integer)
'This is where you put validation code
'This event gets called when the following actions occur
Select Case Action
Case vbDataActionMoveFirst
Case vbDataActionMovePrevious
Case vbDataActionMoveNext
Case vbDataActionMoveLast
uGefysLwmvufpJG 302
Case vbDataActionAddNew
Case vbDataActionUpdate
Case vbDataActionDelete
Case vbDataActionFind
Case vbDataActionBookmark
Case vbDataActionClose
End Select
'Screen.MousePointer = vbHourglass
End Sub

109/ OLEField Double Click twGuf-


Private Sub oleFields_DblClick(Index As Integer)
'this is the way to get data into an empty ole control
'and have it saved back to the table
oleFields(Index).InsertObjDlg
End Sub
----------0-0-0----------
Toolbox xJwGif Crystal Report Smart Icon xnfhjcif;
110/ Toolbox wGif Right Click ESyd yf g/ xdt
k cg Short Cut Menu ay:vmygu
Components... udkxyfrHa½G;cs,f&rnf/ yHk(328)/

yHk(328)
303 Microsoft Visual Basic 6.0

111/ Components Dialog Box ay:vmygu Crystal Report Control 4.6 udk
a½G;NyD; Check vkyf&rnf/ xdkYaemuf Apply, OK udkxyfrHa½G;cs,f&rnf/ yHk(329)/

yHk(329)

112/ Crystal Report Control 4.6 ud k a ½G ; Ed k i f j cif ; onf C:\WINDOWS\


SYSTEM\CRYSTL32.OCX zdkif½Sdjcif;aMumifhjzpfonf/ xdktcg Toolbox ü Crys-
tal Report Icon a&muf½v
dS mrnf/ yH(k 330)/

yHk(330)

----------0-0-0----------
uGefysLwmvufpJG 304

Crystal Report wnfaqmufjcif; ( ,cif Access File )


113/ yxrOD;pGm Visual Basic 6.0 udzk iG yhf g/ xdaYk emuf Menu Bar rS Add-Ins
udk a½G;í Pulldown Menu wpfcjk zpfaom Report Designer... udak ½G;cs,&f rnf/ yH(k 331)

yHk(331)

114/ yHk(332)ygtwdkif;jzpfay:vmygu Cancel Command Button udak ½G;cs,yf g/

yHk(332)
305 Microsoft Visual Basic 6.0

115/ Crystal Reports Registration Express Dialog Box aysmufomG ;vdrrhf nf/
xdt
k cg Report wnfaqmuf&eftqifoifhjzpfaeayvdrfhrnf/ Crystal Reports Pro
Dialog Box wGif New... udkyHk(333)wGifa½G;yguyHk(334)ygtwdkif; Create New Re-
port Dialog Box jzpfay:vmrnf/

yHk(333)

yHk(334)

116/ Create New Report Dialog Box xJrS Standard udkxyfrHa½G;cs,fygu


yHk(335)ygtwdkif;jzpfay:vmayrnf/
uGefysLwmvufpJG 306

yHk(335)

117/ Create Report Expert Dialog Box wGif Data File Command Button
udk xyfrHa½G;cs,f&rnf/ yHk(336)/

yHk(336)

118/ Choose Database File Dialog Box xyfrHay:vmNyD; rdrdtoHk;jyKvdkonfh


Database File udkxyfrHa½G;cs,f&ef List Files of Type:List Box udk Access Files
(or) User Default [kajymif;yg/ rdrdtvdk½Sdonfh Drives:, Directories: wdkYtm;
ajymif;vJí tvdk½Sdonfh Microsoft Database File udka½G;cs,fNyD; Add Command
Button udk a½G;cs,f&rnf/ yHk(337)/
307 Microsoft Visual Basic 6.0

yHk(337)
119/ Choose Database File Dialog Box \trSm;jcpf Close Button udka½G;jcif;
jzifh aomfvnf;aumif;? Done Command Button udak ½G;jcif;jzifah omfvnf;aumif; xyfrH
aqmif½u G &f rnf/ xdt
k cg Choose Database File Dialog Box aysmufomG ;rnf/ yH(k 338)
uGefysLwmvufpJG 308

yHk(338)

120/ Create Report Expert Dialog Box wGif Step 1: Tables, 2: Fields, 3:
Sort, 4: Total, 5: Select, 6: Style [lí Tab Command (6)ck 0ifyg0ifNyD; 2: Fields
tm;xyfraH ½G;cs,yf g/ yH(k 339)/

yHk(339)

121/ Database Fields: acgif;pOfatmuf½Sd Database Fields: rsm;xJrS rdrdtvdk½Sd


aom Field rsm;tm; Report Fields: acgif;pOfatmufoyYkd &Ykd rnf/ Field wpfcck si;f a½G;vdk
ygu Command Button jzif h a ½G ; cs,f N yD ; Field tm;vH k ; a½G ; vd k y gu
Command Button jzifha½G;cs,f&rnf/ yHk(340)/
309 Microsoft Visual Basic 6.0

yHk(340)
122/ xdkYaemuf Next>> Command Button udak ½G;cs,yf g/ yH(k 341)/

yHk(341)

123/ xdt
k cg Tab Command wpfcjk zpfaom 3: Sort odaYk &muf½o dS mG ;rnf/ txufyg
yHk(341)wGif rdrdtkyfpkzJGUvdkonfh Field tm; tkyfpkzJGUEdkifonf/ tkyfpkzJGU&ef rvdktyfygu
Preview Report udx k yfraH ½G;yg/ yH(k 342)/
uGefysLwmvufpJG 310

yHk(342)

124/ txufygyHw
k iG af zmfjyxm;aom Design tm;a½G;cs,yf gu yH(k 343)twdik ;f jyKjyif
rGrf;rHEdkif&ef tajctaeay;vdrfhrnf/
311 Microsoft Visual Basic 6.0

yHk(343)

125/ xdaYk emuf Menu Bar ½Sd Insert udak ½G;cs,yf g/ Pulldown Menu wpfcjk zpfaom
Text Field uda k ½G;cs,yf g/ yH(k 344)/
uGefysLwmvufpJG 312

yHk(344)

126/ xdt
k cg Edit Text Field Dialog Box ay:vmNyD; acgif;pOftm;rdrdpdwfBuKduf
zefwD;í&ayonf/ yHk(345)/ xdkYaemuf Accept Command Button udak ½G;cs,yf g/

yHk(345)

127/ acgif;pOftm; Alignment csdef&efrdrd½dkufESdyfxm;onfh acgif;pOf Text Box


tm; a½G;NyD; Right Click udak ½G;yg/ Short Cut Menu ay:vmrnf/ xdkYaemuf Change
Format... udka½G;cs,f&rnf/ yHk(346)/
313 Microsoft Visual Basic 6.0

yHk(346)

128/ xdt
k cg Format String Dialog Box ay:vmrnf/ yHk(347)4if;rS Align-
ment wGif Centered udk a½G;Ny;D OK udx
k yfraH ½G;cs,yf gu acgif;pOfpmom; tv,fño
§d mG ;
ayrnf/ yHk(348)

yHk(347)
uGefysLwmvufpJG 314

yHk(348)

129/ txufyg Report File tm;odr;f vdyk gu Menu Bar ½Sd File udak ½G;cs,yf g/
xdkYaemuf Pulldown Menu xJrS Save udka½G;cs,fyg/ yHk(349)

yHk(349)
315 Microsoft Visual Basic 6.0

130/ xdtk cg File Save As Dialog Box ay:vmrnf/ rdrdpdwfBuKdufodrf;vdkonfh


zdkiftrnfudkay;NyD; OK udk Click vky&f rnf/ yH(k 350)/

yHk(350)

131/ Crystal Reports Title Bar onfvnf; [Untitled Report #1] r[kwfawmh
bJ [c:\program files\microsoft visual studio\vb98\std09.rpt] [líajymif;vJomG ;ay
rnf/ yH(k 351)/

yHk(351)
----------0-0-0----------
uGefysLwmvufpJG 316

Crystal Report wnfaqmufjcif; ( Access File 2000 txuf )


132/ yxrOD;pGm Visual Basic 6.0 udzk iG yhf g/ xdaYk emuf Menu Bar rS Add-Ins
udk a½G;í Pulldown Menu wpfcjk zpfaom Report Designer... udka½G;cs,f&rnf/ Cre-
ate Report Expert Dialog Box a&mufonftxdtqifhqifhjyKvkyfNyD; SQL/ODBC
Command Button udka½G;cs,f&rnf/ yHk(352)

yHk(352)

133/ xdt
k cg Log On Server Dialog Box topfwpfckay:vmrnf/ yHk(353)

yHk(353)

134/ yH(k 353)yg Dialog Box rS ODBC:exam01 udka½G;cs,fyg/ xdkYaemuf OK


udk Click vkyyf g/ xdt
k cg Choose SQL Table Dialog Box ay:vmrnf/ yH(k 354)/
317 Microsoft Visual Basic 6.0

yHk(354)

135/ Choose SQL Table Dialog Box xJrS SQL Tables: acgif;pOfatmuf½Sd
List Box wGif rdrp
d w
d Bf uKu
d f Table File udadk ½G;cs,&f rnf/ Oyrm - exam01 udak ½G;cs,yf g/
Add Command Button udkxyfrHa½G;cs,fyg/ Close Button udka½G;cs,fygu yHk(355)
ygtwdkif;jzpfvmrnf/

yHk(355)

136/ yHk(355)wGif Next >> Command Button udkxyfrHa½G;cs,f&rnf/ yHk(356)yg


twdkif;azmfjyrnf/
uGefysLwmvufpJG 318

yHk(356)

137/ txufygyHk(356)wGif Database Fields: ü Field rsm;pdwfBuKduf(odkYr[kwf)


tm;vH;k udk a½G;cs,Ef ikd af yonf/ Oyrm-Fields rsm;tm;vH;k a½G;cs,&f ef All->>Command
Button udka½G;cs,f&rnf/ yHk(357)

yHk(357)

138/ xdkYaemuf Next udkxyfrHa½G;cs,fyg/ yHk(358)ygtwdkif;azmfjyrnf/


319 Microsoft Visual Basic 6.0

yHk(358)

139/ txufygyH(k 358)wGif Group Fields aqmif½u


G v
f ykd gu vkyyf ikd cf iG ahf y;xm;Ny;D
raqmif½Gufvdkygu Preview Report Command Button udka½G;cs,f&rnf/ xdktcg
yHk(359)twdkif; jzpfay:vmrnf/

yHk(359)
uGefysLwmvufpJG 320

140/ Design Tab Command Button udak ½G;cs,y


f gu yH(k 360)ygtwdik ;f jzpfay:vm
rnf/

yHk(360)
141/ txufygyHk(360)wGifazmfjyxm;aom Crystal Report File tm;odr;f vdyk gu
Menu Bar wGif½Sdonfh File uda k ½G;cs,yf g/ Pulldown Menu wpfckjzpfaom Save udk
a½G;cs,yf g/ xdt
k cg File Save As Dialog Box ay:vmrnf/ rdrdpdwfBuKdufvrf;aMumif;
wGif Report File Name udkjznfhpGufNyD; OK Command Button udka½G;cs,f&rnf/
yH(k 361)/
321 Microsoft Visual Basic 6.0

yHk(361)

----------0-0-0----------
Crystal Report jzifh Graphic File ½dkufxkwfjcif;
142/ yxrOD;pGm Visual Basic 6.0 wGif "gwfyrkH sm;yg0ifaom Access File udk
wnfaqmufxm;&rnf/ "gwfyrkH sm;udk Windows BitMap File Format jzifo h m Data
Entry jyKvy
k &f rnf/ Access 2000 xufapmaom ,cif Access File rsm;twGufrl
Crystal Report \vkyfydkifcGifhjzpfaom Create Report Expert Dialog Box ay:vm
atmifzefwD;í Data File Command Button udka½G;&rnf/ Access 2000 ESifh txuf
Access File rsm;twGufrl Crystal Report \vkyfydkifcGifhjzpfaom Create Report Ex-
pert Dialog Box ay:vmatmifzefwD;í SQL/ODBC File Command Button udk
a½G;&rnf/

yHk(362)
uGefysLwmvufpJG 322

143/ xdtk cg Log On Server Dialog Box ay:vmrnf/ Server Type: acgif;pOf
atmufwiG f rdrad ½G;cs,rf nfh Database File tm;½SmazG&rnf/ Oyrm - ODBC - Photo01
udka½G;cs,fyg/ xdkYaemuf OK udk Click vky&f rnf/ yH(k 363)/

yHk(363)

144/ Choose SQL Table Dialog Box ay:vmygu rdrdwnfaqmufxm;aom


Database File xJwi
G yf g0ifonfh Table File udka½G;cs,fNyD; Add Command Button
udk xyfrHa½G;cs,f&rnf/ yHk(364)/

yHk(364)

145/ Create Report Expert Dialog Box ay:vmNyD; Table File jzpfonfh
Photo01 File ay:vmrnf/ yH(k 365)/
323 Microsoft Visual Basic 6.0

yHk(365)

146/ yHk(365)wGif Next >> Command Button udkxyfrHa½G;cs,f&rnf/ yHk(366)yg


twdkif;azmfjyrnf/

yHk(366)

147/ txufygyHk(366)wGif Database Fields: ü Field rsm;pdwfBuKduf(odkYr[kwf)


tm;vH;k udk a½G;cs,Ef ikd af yonf/ Oyrm-Fields rsm;tm;vH;k a½G;cs,&f ef All->>Command
Button udka½G;cs,f&rnf/ yHk(367)
uGefysLwmvufpJG 324

yHk(367)

148/ xdkYaemuf Next udkxyfrHa½G;cs,fyg/ yHk(368)ygtwdkif;azmfjyrnf/

yHk(368)

149/ txufygyH(k 368)wGif Group Fields aqmif½u


G v
f ykd gu vkyyf ikd cf iG ahf y;xm;Ny;D
raqmif½Gufvdkygu Preview Report Command Button udka½G;cs,f&rnf/ xdktcg
yHk(369)twdkif; jzpfay:vmrnf/
325 Microsoft Visual Basic 6.0

yHk(369)

150/ Design Tab Command Button udak ½G;cs,y


f gu yH(k 370)ygtwdik ;f jzpfay:vm
rnf/
uGefysLwmvufpJG 326

yHk(370)

151/ Design View wGif Band (5)ckyg½Sr d nfjzpfonf/ Title, Page header, De-
tails, Page footer, Summary wdjYk zpfMuonf/ Title onf acgif;pOfBuD;twGufjzpfNyD;?
Page header onf pm½Guw f ikd ;f wGiyf g½Srd nfh tkypf ak cgif;pOfrsm;? &ufp?GJ pmrsuEf mS eHygwfrsm;
jzpfEikd o f nf/ Details onf Record rsm;azmfjy&eftwGuf Template rsm;jzpfayonf/
Page footer onfpm½Gut f oD;oD;\atmufq;kH wGiyf g0if&rnfh &ufp?GJ pmrsuEf mS eHygwfrsm;
jzpfEikd yf gonf/ Details ESifh Page footer udk"gwfyHkrsm;xnfhoGif;&efoifhwifhrQwpGmjcm;
&rnf/ xdkYaemuf Menu Bar ½Sd Insert udak ½G;yg/ Pulldown Menu jzpfaom Data-
base Field udkxyfrHa½G;cs,f&rnf/ yHk(371)
327 Microsoft Visual Basic 6.0

yHk(371)

152/ xdt k cg Insert Database Field Dialog Box rS Field wpfckjzpfaom pho-
tos udka½G;NyD; Insert Command Button udka½G;cs,f&rnf/ yHk(372)

yHk(372)
uGefysLwmvufpJG 328

153/ xdt
k cg yH(k 373)ygtwdik ;f "gwfy½kH &dS rnft
h uGuu
f ckd sed q
f í tpm;xd;k twnfjyKNy;D
aomtcg Insert -> Text Field jzifh vdt k yfrnfph mom;rsm;a&;om;yg/ yH(k 374)/

yHk(373)

yHk(374)

154/ tqdyk g Crystal Report File tm; File -> Save udka½G;NyD; Report File
Name ay;&efjzpfonf/
----------0-0-0----------
329 Microsoft Visual Basic 6.0

Access zdkifudk Crystal Report wnfaqmufí Print ½dkufxkwfjcif;


155/ yH(k 375)yg Form1 wGif Command Button rsm;udkoHk;í atmufygtwdkif;
zefwD;wnfaqmufNyD; y½dk*&rfa&;&rnf/

yHk(375)

Crystal Report

Private Sub Command1_Click()


CrystalReport1.PrintReport
End Sub

Private Sub Command2_Click()


Unload Me
End
End Sub

156/ Microsoft Visual Basic 6.0 wGif Menu Bar wpfckjzpfaom Add-ins udk
a½G;cs,fyg/ xdkYaemuf Pulldown Menu xJrS Report Designer... jzifh *.rpt File
wpfzdkifudkwnfaqmufxm;&rnf/ Oyrm-c:\program files\microsoft visual studio\
vb98\ exam01.rpt udw k nfaqmufxm;&rnf/ yH(k 376)/
uGefysLwmvufpJG 330

yHk(376)
157/ Crystal Report \ Properties wGi-f
(u) (Name) - CrystalReport1
( c) BoundReportFooter- False
( *) CopiesToPrinter - 1
(C) Destination - 0 - crptToWindow
( i) DetailCopies - 1
( p) DiscardSaveData - False
(q) Left - 4200
( Z) MarginBottom - 0
( ps) MarginLeft - 0
(n) MarginRight - 0
( #) MarginTop - 0
( X) PrinterCollation - 2 - crptDefault
( !) PrinterCopies - 1
( ¡) PrinterStopPage - 0
(P) PrintFileType - 0 - crptRecord
(w) PrintFileUserRptDateFmt - False
(x) PrintFileUserRptNumberFmt - False
331 Microsoft Visual Basic 6.0

( ') ReportFileName - C:\Program Files\


Microsoft Visual
Studio\VB98\
exam01.rpt
( ") ReportSource - 0 - crptReport
( e) Top - 960
( y) WindowBorderStyle - 2 - crptSizable
( z) WindowControlBox - True
( A) WindowControls - True
(b) WindowHeight - 300
( r) WindowLeft - 100
(,) WindowMaxButton - True
( &) WindowMinButton - True
(v) WindowState - 0 - crptNormal
( 0) WindowTop - 100
(o) WindowWidth - 490
---------------0-0-0---------------
Database File wpfcktwGif;½Sd Table zdkifESpfckudktoHk;jyKíuHprf;rJEIdufjcif;
158/ yxrOD;pGm Microsoft Visual Basic 6.0 \vkyfydkifcGifhwGifyg0ifaom Menu
Bar rS Add-ins udka½G;cs,f&rnf/ xdkYaemuf Pulldown Menu jzpfaom Visual Data
Manager... uda
k ½G;cs,yf g/ yH(k 377)/

yHk(377)

159/ xdt
k cg VisData Dialog Box ay:vmvdrfhrnf/ 4if;rS Menu Bar jzpfaom
File udka½G;cs,fyg/ xdkYaemuf New udkxyfrHa½G;cs,f&rnf/ yHk(378)/
uGefysLwmvufpJG 332

yHk(378)

160/ yHk(378)ygtwdkif; New... udka½G;cs,fygu xyfrHí Sub-Menu wpfckay:vm


rnf/ 4if;rS rdrzd efw;D wnfaqmufrnfh Microsoft Access udak ½G;cs,yf g/ xdt
k cgxyfrí
H
Sub-Menu wpfckay:vmayrnf/ 4if; Sub-Menu rS Version 7.0 MDB... udka½G;cs,f
&rnf/ yH(k 379)/ yH(k 380)ygtwdik ;f ay:vmrnf/

yHk(379)
333 Microsoft Visual Basic 6.0

yHk(380)

161/ yHk(380)wGif Select Microsoft Access Database to Create Dialog Box


ay:vmygu rdrw d nfaqmuftrnfay;vdo k nfh Database File trnfujkd znfph u
G í
f Save
Command Button udka½G;cs,f&ayrnf/ Oyrm - Lucky [kjznfhpGufNyD; Save Com-
mand Button uda k ½G;yg/ VisData Dialog Box wGif VisData:C:\Program\Lucky
Draw\Lucky.mdb [k Title Bar üay:vmayrnf/ xdkYaemuf Database Window
Dialog Box wpfckxyfrHay:vmrnf/ yHk(381)/

yHk(381)
uGefysLwmvufpJG 334

162/ Database Window Dialog Box wGif Properties udka½G;cs,fyg/ xdkYaemuf


Right Click ESy
d yf gu Sub-Menu wpfckay:vmrnf/ xdk Sub-Menu xJrS New Table
udak ½G;cs,yf g/ yH(k 382)/

yHk(382)

163/ xdt
k cg Table Structure Dialog Box ay:vmrnf/ Table Name acgif;pOf
ab; List Box ü rdrdpdwfBuKduf Table File trnfudkjznfhpGufí Add Field Com-
mand Button udka½G;cs,f&rnf/ yHk(383)/

yHk(383)
335 Microsoft Visual Basic 6.0

164/ Add Field Dialog Box ay:vmvdrfhrnf/ xdktcg rdrdtvdk½Sdonfh Field


Name, Field Type, Field Size wdkYudkowfrSwf&rnf/ yHk(384)? yHk(385)/

yHk(384)

yHk(385)

165/ Field Name wpfcc k si;f oGi;f Ny;D ygu OK Command Button udak ½G;cs,&f rnf/
Field Name xyfrHroGif;vdkawmhygu Close Command Button uda k ½G;cs,yf g/ xdt
k cg
yHk(386)ygtwdkif;jzpfay:vmrnf/
uGefysLwmvufpJG 336

yHk(386)
166/ Index Field owfrwS v
f ykd gu Add Index Command Button udka½G;cs,f&
rnf/ xdt k cg Add Index to Luck01 Dialog Box ay:vmygu Name List Box,
Indexed Fields List Box wdkYtm; rdrdpdwfBuKdufowfrSwfNyD; OK Command Button
udka½G;cs,fyg/ xyfrHí Close Command Button udka½G;cs,f&rnf? yHk(387)/

yHk(387)
337 Microsoft Visual Basic 6.0

167/ xdt
k cg rlv Table Structure Dialog Box odkYjyefvnfa&muf½SdoGm;rnf/
yH(k 388)/

yHk(388)

168/ txufyg Table Structure udo


k rd ;f vdyk gu Build the Table Command
Button udka½G;cs,f&rnf/ rlv Database Window Dialog Box odkYjyefvnfa&muf½Sd
oGm;ayrnf/ Close Command Button udka½G;cs,fygu tqdkyg Luck01 Table File
udo
k rd ;f rnfr[kwyf g/ yH(k 389)/
uGefysLwmvufpJG 338

yHk(389)

169/ C:\Program Files\LuckDraw\Lucky.mdb udkwnfaqmufNyD; Luck01


Table File ukw
d nfaqmufcNhJ y;D jzpfonf/ ,cktcg 4if; Database File xJwiG yf if Luck02
Table File udxk yfrw
H nfaqmuf&rnf/ Luck01 ESifh Luck02 Table File rsm;rSm tm;vH;k
wlnDMuojzifh Luck02 Table File tm; Luck01 Table File uJhodkYyif tptqHk;jyef
wnfaqmufyguvnf;&onf/ jzwfvrf;enf;jzifw h nfaqmufvykd gu yH(k 389)wGif jrifawGU
ae&aom Database Window Dialog Box rS Luck01 udka½G;yg/ xdkYaemuf Right
Click ESy
d yf g/ xdt
k cg Short Cut Menu wpfckay:vmrnf/ yHk(390)/

yHk(390)
339 Microsoft Visual Basic 6.0

170/ Short Cut Menu xJrS Copy Structure... udkxyfrHa½G;cs,fyg/ xdktcg


yH(k 391)yg Copy Structure Dialog Box ay:vmrnf/

yHk(391)

171/ 4if; Dialog Box rS Target Connect String: acgif;pOfatmuf Text Box
ü Lucky [kjznfhpGufNyD; Table: acgif;pOfatmuf Text Box ü Luck01 udak ½G;cs,&f rnf
jzpfNyD; Copy Data Check Box udk Check jyKvkyf&efjzpfonf/ xdkYaemuf OK Com-
mand Button uda k ½G;cs,yf g/ yH(k 392)/

yHk(392)

172/ xdktcg VisData Dialog Box ay:vmrnf/ Enter New Table Name
acgif;pOfatmuf Text Box ü rdrdwnfaqmufvdkonfh Table Name udjk znfph u
G &f rnf/
Oyrm - Luck02 [kjznfhpGufNyD; OK Command Button udka½G;cs,f&rnf/ yHk(394)/
uGefysLwmvufpJG 340

yHk(393)

173/ xdt k cg Copy Structure Dialog ay:vmrnf/ rdrdul;vdkonfh Structure


atmifjrifpGmul;NyD;aMumif; Message Box ay:vmayrnf/ OK Command Button
udak ½G;yg/ yH(k 394)/

yHk(394)

174/ xdt
k cg Lucky.mdb Database File xJwGif Luck01 Table File ESifhtvm;
oP²mefwlaom Luck02 Table File jzpfvmrnf/ yH(k 395)/

yHk(395)
341 Microsoft Visual Basic 6.0

175/ uH p rf ; rJ a zguf r nf h y½d k * &rf a &;om;&ef t wG u f a tmuf y g Form yHkpHudk


wnfaqmuf&rnf/ yHk(396)/

yHk(396)
176/ yH(k 396)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu
Label, Text Box, Command Button, Data, Frame wdy
Yk g0ifNy;D
4if;wdkY\ Properties rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif
vdktyfaomy½dk*&rfrsm; a&;om;&rnfjzpfonf/
177/ Label1 - Label Properties rSm -
(u) (Name) - Label1
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - Opaque
( i) BorderStyle- 1 - Fixed Single
( p) Caption - uHprf;rnfhta&&twGuf (qkrJta&twGuf)
(q) Font - -Win---Kalaw, Bold, 18
( Z) WordWrap - False
uGefysLwmvufpJG 342

178/ Label2 - Label Properties rSm -


(u) (Name) - Label2
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - Opaque
( i) BorderStyle- 1 - Fixed Single
( p) Caption - uHprf;rnfhta&&twGuf
(uHprf;rnfhta&twGuf)
(q) Font - -Win---Kalaw, Bold, 18
( Z) WordWrap - False

179/ Label3 - Label Properties rSm -


(u) (Name) - Label3
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - Opaque
( i) BorderStyle- 1 - Fixed Single
( p) Caption - qkrJeHygwf (qkrJeHygwf)
(q) Font - -Win---Kalaw, Bold, 18
( Z) WordWrap - False

180/ Label4 - Label Properties rSm -


(u) (Name) - Label4
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - Opaque
( i) BorderStyle- 1 - Fixed Single
( p) Caption - uHxl;½SiftrSwf (uHxl;½SiftrSwf)
(q) Font - -Win---Kalaw, Bold, 18
( Z) WordWrap - False

181/ Label5 - Label Properties rSm


(u) (Name) - Label5
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - Opaque
( i) BorderStyle- 1 - Fixed Single
343 Microsoft Visual Basic 6.0

( p) Caption - qkrJeHygwf tm; uHxl;½SiftrSwf rS


&&½Sdygonf (qkre
J yH gwf tm;uHx;l ½Sif
trSwf rS &½Sdygonf)
(q) Font - -Win---Kalaw, Bold, 18
( Z) WordWrap - False

182/ Text1 - Text Properties rSm -


(u) (Name) - Text1
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Kalaw, Bold, 18
( i) Text - Empty

183/ Text2 - Text Properties rSm -


(u) (Name) - Text2
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Kalaw, Bold, 18
( i) Text - Empty

184/ Text3 - Text Properties rSm -


(u) (Name) - Text3
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Kalaw, Bold, 18
( i) Text - Empty

185/ Text4 - Text Properties rSm -


(u) (Name) - Text4
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Kalaw, Bold, 18
( i) Text - Empty

186/ Text5 - Text Properties rSm (qkre


J yH gwf tm;)
(u) (Name) - Text5
( c) Alignment - 0 - Left Justify
uGefysLwmvufpJG 344
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Kalaw, Bold, 18
( i) Text - Empty

187/ Text6 - Text Properties rSm (uHxl;½SiftrSwf rS &½Sdygonf)


(u) (Name) - Text6
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Kalaw, Bold, 18
( i) Text - Empty

188/ Text7 - Text Properties rSm (uHprf;&ef Command Button atmuf0Suf


xm;onf)
(u) (Name) - Text7
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Kalaw, Bold, 18
( i) Text - Empty

189/ Command1 - CommandButton Properties rSm-


(u) (Name) - Command1
( c) Caption - uHprf;&&ef (uHprf;&ef)
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Yadanapon, Bold, 22

190/ Command2 - CommandButton Properties rSm-


(u) (Name) - Command2
( c) Caption - y½dk*&&rfrSxGuf&&ef
(y½dk*&rfrSxGuf&ef)
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Innwa, Bold, 20

191/ Command3 - CommandButton Properties rSm-


(u) (Name) - Command3
( c) Caption - uHprf;&&ef (uHprf;rJtrnfpm&if;Munfh&ef)
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Innwa, Bold, 20
345 Microsoft Visual Basic 6.0

192/ Data1 - Data Properties rSm(rjrifap&efwpfckckatmuf0Sufxm;&rnf/)


(u) (Name) - Data1
( c) Align - None
( *) BOFAction - 0 - Move First
(C) Caption - Data1
( i) Connect - Access
( p) DatabaseName - C:\Program Files\LuckyDraw
\Lucky.mdb
(q) EOFAction - 0 - Move Last
( Z) Font - MS Sans Serif, Regular, 8
( ps) RecordsetType - 0 - Table

193/ Frame1 - Frame Properties rSm-


(u) (Name) - Frame1
( c) BorderStyle - 1 - Fixed Single
( *) Caption - Empty
(C) Font - MS Sans Serif, Regular, 8

194/ Frame2 - Frame Properties rSm-


(u) (Name) - Frame2
( c) BorderStyle - 1 - Fixed Single
( *) Caption - Empty
(C) Font - MS Sans Serif, Regular, 8

195/ Frame3 - Frame Properties rSm-


(u) (Name) - Frame3
( c) BorderStyle - 1 - Fixed Single
( *) Caption - Empty
(C) Font - MS Sans Serif, Regular, 8

196/ Frame4 - Frame Properties rSm-


(u) (Name) - Frame4
( c) BorderStyle - 1 - Fixed Single
( *) Caption - Empty
(C) Font - MS Sans Serif, Regular, 8
uGefysLwmvufpJG 346

197/ (General), (Declaration) twGuf-


Dim MyDb As Database, MyData As Recordset

198/ uHprf;&ef Command Button1 twGuf-


Private Sub Command1_Click()
Dim MyDb As Database, MyData As Recordset
Dim zaw As Boolean
Dim a, b As Integer
a = Val(Text1)
b = Val(Text3)
If Text1 <> Empty Then
Text5 = b + 1
Text3 = b + 1
Text5 = Text3
If b + 1 >= a Then
Text3 = b + 1
Text5 = b + 1
Text6 = 0
Command1.Visible = False
Form2.Show
End If
Text5.ForeColor = "255"
Else
Form3.Show
End If
Text6.ForeColor = "0"
''''''''
zaw = True
Set MyDb = Workspaces(0).OpenDatabase("c:\Program Files\
LuckyDraw\Lucky.mdb")
Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable)
MyData.MoveFirst
c = Text2
sn = Text3
en = 0
d = Int(Rnd() * c) + 1
347 Microsoft Visual Basic 6.0

Do While zaw = True


MyData.Index = "Luckno"
MyData.Seek "=", d
If MyData.NoMatch Then
zaw = False
Else
d = Int(Rnd() * c + 1)
End If
Loop
Text6 = d
Text4 = d
MyData.AddNew
MyData("Luckno") = Text6
MyData.Update
Text6.ForeColor = "65535"
Text7 = 0
Data1.Refresh
End Sub

199/ y½dk*&rfrSxGuf&ef Command Button2 twGuf-


Private Sub Command2_Click()
Unload Me
End
End Sub

200/ uHprf;rJtrnfpm&if;Munfh&ef Command Button3 twGuf-


Private Sub Command3_Click()
Dim MyDb As Database, MyData As Recordset, MyDatapp As Recordset
Dim ss As Integer
Set MyDb = Workspaces(0).OpenDatabase("c:\Program Files\
LuckyDraw\Lucky.mdb")
Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable)
Set MyDatapp = MyDb.OpenRecordset("Luck02", dbOpenTable)
If MyDatapp.RecordCount > 0 Then
MyDatapp.MoveFirst
Do While MyDatapp.EOF = False
uGefysLwmvufpJG 348
MyDatapp.Delete
MyDatapp.MoveNext
Loop
End If
MyData.MoveFirst
ss = 0
Do While MyData.EOF = False
yy = MyData("Luckno")
If yy < 9999 And yy <> 0 Then
MyDatapp.AddNew
MyDatapp("Luckno") = yy
MyDatapp("srno") = ss
MyDatapp.Update
End If
MyData.MoveNext
ss = ss + 1
Loop
MyDatapp.MoveFirst
Form5.Show
End Sub

201/ Data1 Reposition twGuf-


Private Sub Data1_Reposition()
Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
End Sub

202/ Form Load twGuf-


Private Sub Form_Load()
Set MyDb = Workspaces(0).OpenDatabase("C:\Program Files\
LuckyDraw\Lucky.mdb")
Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable)
MyData.AddNew
MyData("Luckno") = 0
MyData.Update
Data1.Refresh
End Sub
349 Microsoft Visual Basic 6.0

203/ Form Unload twGuf


Private Sub Form_Unload(Cancel As Integer)
Set MyDb = Workspaces(0).OpenDatabase("c:\Program Files\
LuckyDraw\Lucky.mdb")
Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable)
MyData.MoveFirst
Do Until MyData.EOF
MyData.Delete
MyData.MoveNext
Loop
Data1.Refresh
End Sub

204/ Lucky Draw Program BuD;udk Run í&Edkifap&ef yHk(397)wGifyg0ifaom


Form File rsm;udkwnfaqmuf&ayrnf/

yHk(397)
uGefysLwmvufpJG 350

205/ qufvufí Form2 udkwnfaqmuf&ayrnf/ yHk(398)/

yHk(398)

206/ yH(k 398)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu


Label, Command Button, Frame wdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udk
jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaomy½dk*&rfrsm; a&;om;
&rnfjzpfonf/
207/ Label1 - Label Properties rSm -
(u) (Name) - Label1
( c) Alignment - 2 - Center
( *) AutoSize - False
(C) BackStyle - Opaque
( i) BorderStyle- 0 - None
( p) Caption - uHprf;rJukefaeygNyD (uHprf;rJukefaeygNyD)
(q) Font - -Win---Taungyi, Bold, 26
( Z) WordWrap - False

208/ Frame1 - Frame Properties rSm-


(u) (Name) - Frame1
( c) BorderStyle- 1 - Fixed Single
( *) Caption - Empty
(C) Font - MS Sans Serif, Regular, 8
351 Microsoft Visual Basic 6.0

209/ Command1 - CommandButton Properties rSm-


(u) (Name) - Command1
( c) Caption - ydwf&&ef (ydwf&ef)
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Yadanapon, Bold, 28

210/ ydwf&ef Command Button1 twGuf-


Private Sub Command1_Click()
Form2.Hide
Unload Form2
End Sub

211/ qufvufí Form3 udkwnfaqmuf&ayrnf/ yHk(399)/

yHk(399)

212/ yH(k 399)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu


Label, Command Button, Frame wdkYyg0ifNyD; 4if;wdkY\ Properties
rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;
a&;om;&rnfjzpfonf/
213/ Label1 - Label Properties rSm -
(u) (Name) - Label1
( c) Alignment - 2 - Center
( *) AutoSize - False
(C) BackStyle - Opaque
( i) BorderStyle- 0 - None
uGefysLwmvufpJG 352
( p) Caption - uHprf;rJta&&twGufxnfhyg
(uHprf;rJta&twGufxnfh&ef)
(q) Font - -Win---Taungyi, Bold, 24
( Z) WordWrap - False

214/ Frame1 - Frame Properties rSm-


(u) (Name) - Frame1
( c) BorderStyle- 1 - Fixed Single
( *) Caption - Empty
(C) Font - MS Sans Serif, Regular, 8

215/ Command1 - CommandButton Properties rSm-


(u) (Name) - Command1
( c) Caption - ydwf&&ef (ydwf&ef)
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Yadanapon, Bold, 28

216/ ydwf&ef Command Button1 twGuf-


Private Sub Command1_Click()
Form3.Hide
Unload Form3
Form1.Show
End Sub

217/ qufvufí Form4 udkwnfaqmuf&ayrnf/ yHk(400)/

yHk(400)
353 Microsoft Visual Basic 6.0

218/ yH(k 400)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu


Label, Command Button, Frame wdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udk
jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaomy½dk*&rfrsm; a&;om;
&rnfjzpfonf/
219/ Label1 - Label Properties rSm -
(u) (Name) - Label1
( c) Alignment - 2 - Center
( *) AutoSize - False
(C) BackStyle - Opaque
( i) BorderStyle- 0 - None
( p) Caption - qkrJwpfcktwGufwpfBudrfomESdyfyg
(qkrJwpfcktwGufwpfBudrfomESdyfyg)
(q) Font - -Win---Kalaw, Bold, 22
( Z) WordWrap - False

220/ Frame1 - Frame Properties rSm-


(u) (Name) - Frame1
( c) BorderStyle- 1 - Fixed Single
( *) Caption - Empty
(C) Font - MS Sans Serif, Regular, 8

221/ Command1 - CommandButton Properties rSm-


(u) (Name) - Command1
( c) Caption - ydwf&&ef (ydwf&ef)
( *) BorderStyle- 1 - Fixed Single
(C) Font - -Win---Yadanapon, Bold, 28

222/ ydwf&ef Command Button1 twGuf-


Private Sub Command1_Click()
Form4.Hide
Unload Form4
End Sub
uGefysLwmvufpJG 354

223/ qufvufí Form5 udkwnfaqmuf&ayrnf/ yHk(401)/

yHk(401)

224/ yH(k 401)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu


DBGrid, Data, Command ButtonwdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udk
jyifqifjznfph uG Nf y;D aemuf Command Button wGif vdt
k yfaomy½d*k &rfrsm; a&;om;&rnf
jzpfonf/
225/ DBGrid1 - DBGrid Properties rSm -
(u) (Name) - DBGrid1
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - False
(C) AllowArrows - True
( i) AllowDelete - False
( p) AllowUpdate - True
355 Microsoft Visual Basic 6.0

(q) BorderStyle - 1 - Fixed Single


( Z) Caption - None
( ps) DataMode - 0 - Bound
(n) DataSource - Data1
( #) Font - MS Sans Serif, Regular, 8

226/ Data1 - Data Properties rSm-


(u) (Name) - Data1
( c) Align - 0 - None
( *) BOFAction - 0 - Move First
(C) Connect - Access
( i) DatabaseFile - C:\Program Files\LuckyDraw
\Lucky.mdb
( p) EOFAction - 0 - Move Last
(q) Font - MS Sans Serif, Regular, 8
( Z) RecordsetType - 1 - Dynaset
( ps) RecordsetSource - Luck02

227/ Command1 - CommandButton Properties rSm-


(u) (Name) - Command1
( c) Caption - ydwf&&ef (ydwf&ef)
( *) BorderStyle - 1 - Fixed Single
(C) Font - -Win---Yadanapon, Bold, 20

228/ ydwf&ef Command Button1 twGuf-


Private Sub Command1_Click()
Unload Me
End Sub

229/ Data1 Reposition twGuf-


Private Sub Data1_Reposition()
Data1.Caption = " Record: " & (Data1.Recordset.AbsolutePosition + 1)
End Sub

230/ tqdyk g y½d*k &rfukd Run ygu yHk(402)ygtwdkif;jrifawGU&rnf/


uGefysLwmvufpJG 356

yHk(402)
231/ Oyrm - qkrtJ a&twGuf 6 ckom½SNd y;D ? uHprf;rnft
h a&twGurf mS 125 OD;½Syd gu
qkrJta&twGufnmzuf½Sd tqdkyg y½dk*&rfudk Run ygu yH(k 402)ygtwdik ;f jrifawGU&rnf/
qkrJta&twGuf 6 ck½Sdojzifh uHprf;&ef Command Button tm; 6 cgESdyfNyD;ygu
uHprf;rJukefaeygNyD[laom Message Box jyvmrnf/ yH(k 403)/

yHk(403)

232/ tqdyk g Message Box tm; ydwf&ef Command Button udEk ydS yf gu Mes-
sage Box aysmufomG ;Ny;D ? uHprf;&ef Command Button ygaysmufomG ;vdrr
hf nf/ yH(k 404)/
357 Microsoft Visual Basic 6.0

yHk(404)
233/ uHprf;rJtrnfpm&if;Munf&h ef Command Button udEk ydS yf gu yH(k 405)ygtwdik ;f
jrifawGU&rnf/

yHk(405)

234/ txufyg Form yHkpHwGif ydwf&ef Command Button udka½G;cs,fygu rlv


uHprf;rJEdIufonfh Form yHkpHodkYjyefvnfa&muf½SdoGm;NyD;? y½dk*&rfrSxGuf&ef Command
Button udE k ydS yf gu tqdyk g Form yHpk rH x
S u
G o
f mG ;vdrrhf nf/
---------------0-0-0---------------
uGefysLwmvufpJG 358

ODBC jzifhzefwD;xm;aom Access zdkifudktouf? vkyfouf? yifpif,lrnfhESpfwGufjcif;


235/ Access 2000 (or) Access 2002 wdjYk zifh Database File wpfcu
k w
kd nfaqmuf
xm;&rnf/ 4if; Database File rS Table File wGifatmufygZ,m;twdkif;wnfaqmuf
xm;NyD; Record rsm;xnfhxm;&rnf-

Field Name Data Type Field Size


IDNo Text 8
Name Text 30
Date of Birth Date
Enrollment Date
Age Number Double, Fixed, Decimal 2
Services Year Number Double, Fixed, Decimal 2
Retire Year Date

236/ Oyrm - Retire [k Database File, Table File wdw Yk iG t


f rnfay;xm;yg/
xdkYaemuf 4if;zdkifudk ODBC \vkyfydkifcGifhodkYajymif;vJNyD; Microsoft Visual Basic 6.0
jzifh atmufazmfjyyg Form yHkpHudkwnfaqmufxm;&rnf/

yHk(406)
237/ yH(k 406)yg Form yHpk w
H iG f , , rsm;jzifh
zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command
Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/

238/ Adodc1 - Adodc Properties twGuf -


(u) (Name) - Adodc1
( c) Align - 0 - vbAlignNone
359 Microsoft Visual Basic 6.0

( *) BOFAction - 0 - adDoMoveFirst
(C) ConnectingString - provider=msdasql;dsn= retire;
uid=;pwd=;
( i) EOFAction - 0 - adDoMoveLast
( p) Font - MS Sans Serif, Bold, 8
(q) RecordSource - select [IDNo], Name, [Date of
Birth], [Enrollment], Age,
[Services Year], [Retire Year] from
retire order by [IDNo]

239/ DataGrid1 - DataGrid Properties twGuf -


(u) (Name) - DataGrid1
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - False
(C) AllowArrows - True
( i) AllowDelete - False
( p) AllowUpdate - True
(q) Font - MS Sans Serif, Regular, 8
( Z) DataSource - Adodc1

240/ Adodc1 - Adodc \ Record Position twGuf -


Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason
Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event
StatusEnum, ByVal pRecordset As ADODB.Recordset)
Adodc1.Caption = "Record: " & CStr(Adodc1.Recordset.AbsolutePosition)
End Sub

241/ Age Command Button twGuf -


Private Sub Command1_Click()
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
x = (Date - Adodc1.Recordset("Date of Birth")) / 365.25
Adodc1.Recordset("Age") = x
Adodc1.Recordset.MoveNext
Loop
Adodc1.Recordset.MoveFirst
End Sub
uGefysLwmvufpJG 360

242/ Services Command Button twGuf -


Private Sub Command2_Click()
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
y = (Date - Adodc1.Recordset("Enrollment")) / 365.25
Adodc1.Recordset("Services Year") = y
Adodc1.Recordset.MoveNext
Loop
Adodc1.Recordset.MoveFirst
End Sub

243/ Retire Year Command Button twGuf -


Private Sub Command3_Click()
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
mdy = Adodc1.Recordset("Date of Birth")
myear = Year(mdy) + 60
mmth = Month(mdy)
mday = Day(mdy)
zzz = mday & "-" & mmth & "-" & myear
Adodc1.Recordset("Retire Year") = zzz
Adodc1.Recordset.MoveNext
Loop
Adodc1.Recordset.MoveFirst
End Sub

244/ Exit Command Button twGuf -


Private Sub Command4_Click()
Unload Me
End
End Sub

245/ tqdyk gy½d*k &rfukd Run yguyHk(406)ygtwdkif;jrifawGU&rnf/ Age Command


Button udkESdyfygu toufrsm;wGufcsufay;rnfjzpfNyD;? Services Year Command
Button udk ESdyfygu trIxrf;oufrsm;wGufcsufay;vdrfhrnf/ Retire Year Comamand
Button udk ESdyfygu yifpif,lrnfh &uf? v? ckESpfwdkYudkwGufcsufay;vdrfhrnf/ yHk(407)/
361 Microsoft Visual Basic 6.0

yHk(406)

yHk(407)

---------------0-0-0---------------
uGefysLwmvufpJG 362

Visual Basic 6.0 jzifhzefwD;xm;aom Access zdkifudk Printer jzifh½dkufxkwfjcif;


246/ Visual Basic 6.0 jzifhyif Database File wpfckudkwnfaqmufxm;&rnf/
4if; Database File rS Table File wGifatmufazmfjyygZ,m;twdkif;wnfaqmufxm;NyD;
Record rsm;xnfx h m;&rnf/
Field Name Data Type Field Size
IDNo Text 8
Name Text 25
Date of Birth Date
Enrollment Date
Age Double
Services Year Double
Retire Year Date

247/ Oyrm - Retired [k Database File, Table File wdw Yk iG t


f rnfay;xm;yg/
xdkYaemuf Microsoft Visual Basic 6.0 jzifh atmufazmfjyyg Form yHkpHudkwnfaqmuf
xm;&rnf/

yHk(408)

248/ yH(k 408)yg Form yHpk w


H iG f rsm;jzifh zefw;D xm;Ny;D oufqikd &f m
Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaom
y½dk*&rfrsm;a&;om;&ef jzpfygonf/
363 Microsoft Visual Basic 6.0

249/ Report Command Button twGuf-


Private Sub Command1_Click()
Command3.Visible = True
Command4.Visible = True
End Sub

250/ Exit Command Button twGuf-


Private Sub Command2_Click()
Command3.Visible = False
Command4.Visible = False
Unload Me
End
End Sub

251/ Soft Copy Command Button twGuf-


Private Sub Command3_Click()
Form3.Show
End Sub

252/ Hard Copy Command Button twGuf-


Private Sub Command4_Click()
Form2.Show
End Sub

253/ Form Load twGuf-


Private Sub Form_Load()
Command3.Visible = False
Command4.Visible = False
End Sub

254/ Soft Copy Command Button udka½G;cs,fygu Form2.Show [ky½dk*&rf


a&;om;xm;ojzifh Form2 udkyHk(409)ygtwdkif;zefwD;wnfaqmuf&rnf/
uGefysLwmvufpJG 364

yHk(409)
255/ yH(k 409)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu
DBGrid, Label, Text Box, Data, Command ButtonwdyYk g0ifNy;D
4if;wdkY\ Properties rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button wGif vdktyf
aomy½dk*&rfrsm;a&;om;&rnfjzpfonf/
256/ DBGrid1 - DBGrid Properties rSm -
(u) (Name) - DBGrid1
( c) Align - 0 - vbAlignNone
( *) AllowAddNew - False
(C) AllowArrows - True
( i) AllowDelete - False
( p) AllowUpdate - True
(q) BorderStyle - 1 - Fixed Single
( Z) Caption - None
( ps) DataMode - 0 - Bound
(n) DataSource - Data1
( #) Font - MS Sans Serif, Regular, 8

257/ Label1 - Label Properties rSm-


(u) (Name) - Label1
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
365 Microsoft Visual Basic 6.0

(C) BackStyle - 0 - Transparent


( i) BorderStyle - 1 - Fixed Single
( p) Caption - All Records
(q) Font - MS Sans Serif, Bold, 8

258/ Text1 - Text Properties rSm-


(u) (Name) - Text1
( c) Alignment - 0 - Left Justify
( *) BorderStyle - 1 - Fixed Single
(C) Font - MS Sans Serif, Bold, 8
( i) Text - Empty

259/ Data1 - Data Properties rSm-


(u) (Name) - Data1
( c) Align - 0 - None
( *) BOFAction - 0 - Move First
(C) Connect - Access
( i) DatabaseFile - C:\Program Files\Microsoft Visual
Studio\VB98\Retired.mdb
( p) EOFAction - 0 - Move Last
(q) Font - MS Sans Serif, Regular, 8
( Z) RecordsetType - 1 - Dynaset
( ps) RecordsetSource - Retired

260/ Command1 - CommandButton Properties rSm-


(u) (Name) - Command1
( c) Caption - To Calculate Age
( *) Font - MS Sans Serif, Regular, 8

261/ Command2 - CommandButton Properties rSm-


(u) (Name) - Command2
( c) Caption - To Calculate Services Year
( *) Font - MS Sans Serif, Regular, 8

262/ Command3 - CommandButton Properties rSm-


(u) (Name) - Command3
( c) Caption - To Calculate Retire Year
uGefysLwmvufpJG 366

( *) Font - MS Sans Serif, Regular, 8

263/ Command4 - CommandButton Properties rSm-


(u) (Name) - Command4
( c) Caption - &Return to Main Menu
( *) Font - MS Sans Serif, Regular, 8
264/ To Calculate Age Command Button1 twGuf-
Private Sub Command1_Click()
Set MyDb = Workspaces(0).OpenDatabase("Retired.mdb")
Set MyData = MyDb.OpenRecordset("Retired", dbOpenTable)
MyData.MoveFirst
Do While MyData.EOF = False
MyData.Edit
x = (Date - MyData("Date of Birth")) / 365.25
MyData("Age") = x
MyData.Update
MyData.MoveNext
Loop
MyData.MoveFirst
End Sub

265/ To Calculate Services Year Command Button2 twGuf-


Private Sub Command2_Click()
Set MyDb = Workspaces(0).OpenDatabase("Retired.mdb")
Set MyData = MyDb.OpenRecordset("Retired", dbOpenTable)
MyData.MoveFirst
Do While MyData.EOF = False
MyData.Edit
y = (Date - MyData("Enrollment")) / 365.25
MyData("Services Year") = y
MyData.Update
MyData.MoveNext
Loop
MyData.MoveFirst
End Sub
367 Microsoft Visual Basic 6.0

266/ To Calculate Retire Year Command Button3 twGuf-


Private Sub Command3_Click()
Set MyDb = Workspaces(0).OpenDatabase("Retired.mdb")
Set MyData = MyDb.OpenRecordset("Retired", dbOpenTable)
MyData.MoveFirst
Do While MyData.EOF = False
MyData.Edit
mdy = MyData("Date of Birth")
myear = Year(mdy) + 60
mmth = Month(mdy)
mday = Day(mdy)
zzz = mday & "-" & mmth & "-" & myear
MyData("Retire Year") = zzz
MyData.Update
MyData.MoveNext
Loop
MyData.MoveFirst
End Sub

267/ Return to Main Menu Command Button4 twGuf-


Private Sub Command4_Click()
Unload Me
End Sub

268/ Data1 Reposition twGuf-


Private Sub Data1_Reposition()
Data1.Caption = " Record: " & (Data1.Recordset.AbsolutePosition + 1)
End Sub

269/ Form Load twGuf-


Private Sub Form_Load()
Set MyDb = Workspaces(0).OpenDatabase("Retired.mdb")
Set MyData = MyDb.OpenRecordset("Retired", dbOpenTable)
MyData.MoveLast
Text1.Text = MyData.RecordCount
End Sub
uGefysLwmvufpJG 368

270/ tqdyk gy½d*k &rfukd Run ygu yHk(410)ygtwdkif;jrifawGU&rnf/ To Calculate


Age Command Button udkESdyfygutoufrsm;wGufcsufay;rnfjzpfNyD;? To Calculate
Services Year Command Button udkESdyfygu trIxrf;oufrsm;wGufcsufay;vdrfhrnf/
To Calculate Retire Year Comamand Button udkESdyfyguyifpif,lrnfh &uf? v?
ckESpfwdkYudkwGufcsufay;vdrfhrnf/

yHk(410)
369 Microsoft Visual Basic 6.0

271/ Hard Copy Command Button udka½G;cs,fygu Form3.Show [ky½dk*&rf


a&;om;xm;ojzifh Form3 udkyHk(411)ygtwdkif;zefwD;wnfaqmuf&rnf/

yHk(411)

272/ yH(k 411)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu


Label, Crstal Report, Combo Box, Command ButtonwdkYyg0ifNyD;
4if;wdkY\ Properties rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button wGif vdktyf
aomy½dk*&rfrsm;a&;om;&rnf jzpfonf/
273/ Combo1 - ComboBox Properties rSm-
(u) (Name) - Combo1
( c) Font - MS Sans Serif, Regular, 8
( *) ItemData - (List)
0 ^ Enter jzifh½dkuf&ef
0
(C) List - [List]
Window ^ Enter jzifh½dkuf&ef
Printer
( i) Style - 0 - DropdownCombo
( p) Text - Window

274/ Label1 - Label Properties rSm-


(u) (Name) - Label1
( c) Alignment - 2 - Center
uGefysLwmvufpJG 370
( *) AutoSize - False
(C) BackStyle - 0 - Transparent
( i) BorderStyle- 0 - None
( p) Caption - Using Crystal Report
(q) Font - MS Sans Serif, Bold, 14

275/ Label2 - Label Properties rSm-


(u) (Name) - Label2
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - 0 - Transparent
( i) BorderStyle- 0 - None
( p) Caption - Print Destination
(q) Font - MS Sans Serif, Bold, 10

276/ Label3 - Label Properties rSm-


(u) (Name) - Label3
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - 0 - Transparent
( i) BorderStyle- 0 - None
( p) Caption - Identification Number From
(q) Font - MS Sans Serif, Bold, 10

277/ Label4 - Label Properties rSm-


(u) (Name) - Label4
( c) Alignment - 0 - Left Justify
( *) AutoSize - False
(C) BackStyle - 0 - Transparent
( i) BorderStyle- 0 - None
( p) Caption - To
(q) Font - MS Sans Serif, Bold, 10

278/ Report1 - Crystal Report Properties rSm-


(u) (Name) - Report1
( c) Destination - 0 - crptToWindow
( *) PrintFileType- 0 - crptRecord
371 Microsoft Visual Basic 6.0

(C) RecordSource- 0 - crptReport


( i) WindowState- 0 - crptNormal

279/ Text1 - Text Properties rSm-


(u) (Name) - Text1
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - MS Sans Serif, Regular, 8
( i) Text - A-00001

280/ Text2 - Text Properties rSm-


(u) (Name) - Text2
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - MS Sans Serif, Regular, 8
( i) Text - A-99999

281/ Combo Box a½G;cs,f&eftwGuf-


Private Sub Combo1_Click()
If Combo1.Text = "Printer" Then
Form4.Show
End If
End Sub

282/ Print Report Command Button twGuf-


Private Sub Command1_Click()
If Combo1.Text = "Window" Then
rpt1 = 0
Else
Combo1.Text = "Printer"
rpt1 = 1
Report1.CopiesToPrinter = num1
End If
pt1 = "{Retired.IDNo} in '" + Trim(Text1.Text) + "' to '" +
Trim(Text2.Text) + "'"
Report1.SelectionFormula = pt1
Report1.Destination = rpt1
uGefysLwmvufpJG 372
a1 = LCase(App.Path)
If Right(App.Path, 1) <> "\" Then a1 = a1 + "\" 'Handles the root
Report1.DataFiles(0) = a1 + "Retired.mdb"
Report1.ReportFileName = a1 + "Retired.rpt"
Report1.Action = 1
End Sub

283/ tqdyk gy½d*k &rfukd Run ygu yHk(412)ygtwdkif;jrifawGU&rnf/ Print Desti-


nation nmzuf½Sd Combo Box Dropdown Arrow udka½G;cs,fygu Window ESifh
Printer [l íjrifawGU&NyD; rdrdtvdk½Sd&mudka½G;cs,fEdkifygonf/ Identification Number
From \nmzuf Text Box wGif Record Identification Number rdrdpvdkonfh
eHygwfrSp&efjzpfNyD; To \nmzuf Text Box ü rdrdtqHk;owf½dkufESdyfvdkonfh Record
Identification Number udkjyifqifjznfhpGuf&efjzpfonf/ Print Report Command
Button udEk ydS yf gu Combo Box udk Window a½G;cs,fcJhygu Printer jzifh½dkufESdyf&ef
Print Preview udk jyrnfjzpfNy;D Printer udak ½G;cs,c
f yhJ gu wdu
k ½f u
kd Printer
f jzifh ½du
k Ef ydS rf nf
jzpfygonf/

yHk(412)
373 Microsoft Visual Basic 6.0

284/ Combo Box wGif Printer uda k ½G;cs,yf gu Form4.Show [ky½d*k &rfa&;om;
xm;jzifh Form4 udkyHk(413)ygtwdkif;zefwD;wnfaqmuf&rnf/

yHk(413)

285/ yH(k 413)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu


Label, Text Box, Command ButtonwdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udk
jyifqif jznfph u
G Nf y;D aemuf Command Button wGif vdt
k yfaomy½d*k &rfrsm; a&;om;&rnf
jzpfonf/
286/ Label1 - Label Properties rSm-
(u) (Name) - Label1
( c) Alignment - 0 - Left Justify
( *) BackStyle - 0 - Transparant
(C) BorderStyle- 0 - None
( i) Caption - Please enter the number of copies
( p) Font - MS Sans Serif, Bold, 10

287/ Label2 - Label Properties rSm


(u) (Name) - Label2
( c) Alignment - 0 - Left Justify
( *) BackStyle - 0 - Transparant
(C) BorderStyle- 0 - None
( i) Caption - you wish to print
( p) Font - MS Sans Serif, Bold, 10
uGefysLwmvufpJG 374

288/ Text1 - TextBox Properties rSm-


(u) (Name) - Text1
( c) Alignment - 0 - Left Justify
( *) BorderStyle- 1 - Fixed Single
(C) Font - MS Sans Serif, Bold, 10
( i) Text - 1

289/ Command1 - CommandButton Properties rSm-


(u) (Name) - Command1
( c) Caption - Accept Number of Copies
( *) Font - MS Sans Serif, Bold, 10

290/ Command2 - CommandButton Properties rSm-


(u) (Name) - Command2
( c) Caption - Reset Number of Copies
( *) Font - MS Sans Serif, Bold, 10

291/ Command1 twGuf-


Private Sub Command1_Click()
num1 = Text1
Form4.Hide
End Sub

292/ Command2 twGuf-


Private Sub Command2_Click()
Text1.Text = "1"
End Sub

---------------0-0-0---------------
375 Microsoft Visual Basic 6.0

Chapter (11)

Visual Basic 6.0 jzifh Program wpfcktm;a&;NyD; Execute File wnfaqmufjcif;


293/ yxrtqifhtaejzifh Microsoft Visual Basic 6.0 jzifh Program wpfyk'f
a&;om;yg/ Oyrm - vuf½SdESpf-v-&uf-em&D-rdepf-puúefYudkjyaom Program wpfyk'fudk
a&;om;xm;&rnf/ zdkif\y½dk*&rftrnfudk extest017.vbp [ktrnfowfrSwfxm;NyD;
Form File udk extest017 .frm [ktrnfowfrw S yf g/ yH(k 414)/

yHk(414)

294/ txufygzdik u
f kd Execute File vkyrf nfqykd gu Menu Bar ½Sd File udak ½G;yg/
Pull Down Menu usvmygu 4if;xJrS Make extest017.exe... udka½G;cs,f&rnf/
yH(k 415)/
uGefysLwmvufpJG 376

yHk(415)

yHk(416)
377 Microsoft Visual Basic 6.0

295/ xdktcg Make Project Dialog Box ay:vmrnf/ rdrdodrf;vdkonfhvrf;


aMumif;? rdro
d rd ;f vdo
k nfh zdik t
f rnfukd jyKjyifjznfph u
G í
f Execute File udw
k nfaqmufEikd f
ayonf/ yHk(417)? yHk(418)/

yHk(417)

yHk(418)
uGefysLwmvufpJG 378

296/ xdt
k cgrdrtd rnfay;vdu
k o
f nft
h wdik ;f c:\Example001.exe jzpfomG ;ayrnf/
4if;zdkifudk Run vdyk gu Computer Desktop wGif½Sdaeaom My Computer Short
Cut Icon udk Double Click (or) Active jzpfaeaomtcg Enter ESy d yf g/ yH(k 419)/

yHk(419)

297/ xdt
k cgyH(k 420)wGiaf zmfjyxm;onft
h wdik ;f [C:]udkDouble Click (or) Active
jzpfaeaomtcg Enter ESyd yf g/

yHk(420)
379 Microsoft Visual Basic 6.0

yHk(421)

298/ yH(k 421)wGijf rifawGUae&aom Example001.exe zdkifudk Run vdyk gu Double


Click (or) Active jzpfaeaomtcg Enter ESy d yf g/

yHk(422)
uGefysLwmvufpJG 380

299/ yHk(422)wGifjrifawGUae&aom Date and Time Testing Form tm; Com-


mand Button wpfckjzpfaom Run udka½G;cs,fygu yHk(423)ygtwdkif; &ufpJG? tcsdefrsm;
azmfjyrnf/ 4if;y½dk*&rfrSxGufvdkygu Close Button udka½G;cs,f&rnf/

yHk(423)

300/ Execute File jyKvkyfí&onfhtwGuf Start → Run → c:\Example001


(or) c:\Example001.exe → OK udka½G;cs,fjcif;jzifhvnf;aumif;? Start → Run
→ command → OK udka½G;cs,fNyD; DOS Prompt rS C:\>Example001 (or)
Example001.exe → Enter uddkESdyfjcif;jzifhvnf;aumif; y½dk*&rfudk Run Edkifayonf/
Visual Basic 6.0 Language r½Sdaomtjcm;pufrsm;odkYul;,lNyD;vnf; Run Edkifayonf/

---------------0-0-0---------------
381 Microsoft Visual Basic 6.0

Visual Basic 6.0 jzifh Program wpfcktm;a&;NyD; Package jyKvkyfjcif;


301/ yxrtqift h aejzifh Microsoft Visual Basic 6.0 jzifh Program wpfy'k af &;
om;yg/ Oyrm - Database File wpfzdkifwnfaqmufNyD; Record tenf;i,foGif;xm;
&rnf/ tqdyk g Database File wGif½Sd Record tcsKUd udk wGucf suaf y;onfh y½d*k &rfwpfy'k f
tm;a&;om;xm; &rnf/ zdik \f y½d*k &rftrnfukd extest111.vbp [ktrnfowfrw S x
f m;Ny;D
Form File udk extest111 .frm [ktrnfowfrw S yf g/ yH(k 424)/

yHk(424)
302/ txufygzdik u
f kd Application Package vkyrf nfqykd gu Menu Bar ½Sd Add-
Ins uda
k ½G;yg/ Pull Down Menu usvmygu 4if;xJrS Package and Deployment
Wizard... udka½G;cs,f&rnf/ yHk(425)/

yHk(425)
uGefysLwmvufpJG 382

303/ xdt
k cg Package and Deployment Wizard Dialog Box ay:vmrnf/
yHk(426)? Package rjyKvkyfrDtqdkyg Project File udo
k rd ;f vdyk gu Yes udka½G;&efjzpfNyD;?
rodr;f vdk ygu No udka½G;cs,f&rnf/ yHk(426)/ Oyrm - No udak ½G;yg/

yHk(426)
304/ Package and Deployment Wizard Dialog Box ay:vmrnf/ 4if; Dia-
log Box wGif rdrd Package vkyfvdkonfh Visual Basic Project File \ wnfae&mudk
jyaernfjzpfNyD; Package Command Button udka½G;cs,f&rnf/ yHk(427)/

yHk(427)

305/ xdkaemuf Compile Command Button udka½G;cs,f&rnf/ xdktcgrSom


Execute File &½Sdayrnf/ yHk(428)/
383 Microsoft Visual Basic 6.0

yHk(428)

306/ Compile vkyNf y;D oGm;ygu yH(k 429)yg Dialog Box ay:vmygu Yes Com-
mand Button udka½G;cs,fyg/

yHk(429)
307/ Package trsK;d tpm;a½G;cs,o
f nfh Dialog Box ay:vmrnf/ Package Type
udk Standard Setup Package ae&mwGifyifxm;í Next udak ½G;cs,yf g/ yH(k 430)/

yHk(430)
308/ Package udkrdrdxnfhvdkonfhvrf;aMumif;üxnfh&eftcGifhta&;&½Sdrnfh Dia-
log Box ay:vmrnf/ yH(k 431)/
uGefysLwmvufpJG 384

yHk(430)

yHk(431)

309/ tqdyk g Dialog Box wGiyf if Folder udkajymif;í Next udak ½G;cs,yf g/ yH(k 432)/

yHk(432)
310/ DAO Driver rsm;udka½G;cs,f&eftajctaeay;onfh Dialog Box ay:vm
ygu zdkiftm;vHk;udka½G;cs,fNyD; Next udk Click ESyd &f rnf/ yH(k 433)/
385 Microsoft Visual Basic 6.0

yHk(433)

311/ Folder vrf;aMumif;topfa½G;cs,o f jzifh aysmufaeonfh *.dll zdik rf sm;pm&if;udk


jyaevdrfhrnf/ rnfodkYyifjzpfap OK udk Click ESyd &f rnfjzpfonf/ yH(k 434)/

yHk(434)

312/ Out-of-Date Dependency Information Dialog Box xyfrHay:vmrnf/


OK udo
k m Click ESyd &f rnfjzpfonf/ yH(k 435)/
uGefysLwmvufpJG 386

yHk(435)

313/ rdrdwnfaqmufrnfh Application Package wGif yg0ifonfh *.dll zdkifrsm;udk


Check Box jzifh Mark vkyfxm;onf/ ra½G;cs,fvdkygu Uncheck jyKvkyfEdkifonf/
tm;vHk;a½G;cs,fxm;ojzifh Next Command Button udo k ma½G;cs,yf g/ yH(k 436)/

yHk(436)
314/ Cab File wnfaqmuf&eftcGifhta&;ay;onfh Dialog Box wpfckay:vm
rnf/ tqdyk g Dialog Box wGif Single cab File wnfaqmufygu cab File wpfzikd w
f nf;
omwnfaqmufNyD; Disk Space rsm;vdrfhrnf/ Multiple cabs Option Button udk
a½G;cs,fygu rdrdwnfaqmufvdkonfh cab size udk 1.44 MB, 2.88 MB, 1.2 Mb,
720KB ponfjzifha½G;cs,fwnfaqmufEdkifayonf/ Oyrm - 1.44 MB udka½G;cs,fygu
387 Microsoft Visual Basic 6.0

jzpfay:vmaom cab File rsm;onf 1.44 MB xufrausmfapbJ cab File rsm;wpfzdkif


xufrujzpfvmayrnf/ tqdkyg Dialog Box wGif Multiple cabs Option Button
udka½G;cs,fyg/ xdkYaemuf Cab size udk 1.44 MB wGifxm;NyD; Next Command But-
ton udka½G;cs,f&efjzpfonf/ yHk(437)/

yHk(437)

315/ Installation Title udkowfrSwf&ef Dialog Box xyfrHay:vmrnf/ Instal-


lation title tm;rdrpd w
d Bf uKu
d o
f wfrw
S yf g/ Oyrm - Result of the Students [kjyifqif
jznfhpGufí Next udka½G;cs,f&rnf/ yHk(438)/

yHk(438)
316/ Package and Deployment Wizard - Start Menu Items Dialog Box
ay:vmrnf/ Next udak ½G;cs,yf g/ yH(k 439)/
uGefysLwmvufpJG 388

yHk(439)

317/ Package and Deployment Wizard - Install Locations Dialog Box


ay:vmrnf/ Next udak ½G;cs,yf g/ yH(k 440)/

yHk(440)
318/ Package and Deployment Wizard - Shared Files Dialog Box ay:vm
rnf/ Shared Files rsm;udk Check jyKvkyfí Next udak ½G;cs,yf g/ yH(k 441)/
389 Microsoft Visual Basic 6.0

yHk(441)
319/ Package and Deployment Wizard - Finished! Dialog Box ay:vm
rnf/ Finish udak ½G;cs,yf g/ yH(k 442)/

yHk(442)

320/ Packaging Report Dialog Box xyfrHay:vmrnf/ Save Report Com-


mand Button uda
k ½G;cs,yf g/ yH(k 443)/
uGefysLwmvufpJG 390

yHk(443)

321/ Save Report Dialog Box xyfrHay:vmrnf/ Save in: List Box wGif
vrf;aMumif;ajymif;vdkyguajymif;NyD; Text File udkodrf;Edkifayonf/ yHk(444)/

yHk(444)

322/ c:\My Documents\Package odkYvrf;aMumif;ajymif;yg/ xdkYaemuf Save


Command Button uda
k ½G;cs,yf g/ yH(k 445)/

yHk(445)

323/ yH(k 443)ygtwdik ;f Dialog Box xyfraH y:vmrnf/ a½G;cs,yf g/ yH(k 446)/ Close
Command Button udka½G;cs,fyg/
391 Microsoft Visual Basic 6.0

yHk(446)

324/ yHk(447)ygtwdkif; Package and Deployment Wizard Dialog Box xyfrH


ay:vmrnf/ Close Command Button udka½G;cs,fyg/ rlvy½dk*&rfodkYomjyefa&muf
oGm;rnf/

yHk(447)

325/ Application Package tm; C:\My Documents\Package xJ w G i f


vrf;aMumif;ay;xm;ojzifh uGefysLwm Desktop ay:wGif½Sdaeonfh Icon wpfckjzpfaom
My Computer rS Munfhygu yHk(448)ygtwdkif;jrifawGUEdkifygonf/
uGefysLwmvufpJG 392

yHk(447)

326/ tjcm;uGeyf sLwmpufwpfv;kH odYk Install jyKvyk v


f ykd gu C:\My Documents\
Package Folder atmuf½Sdzdkiftm;vHk;udk ul;oGm;NyD; Setup.exe udk Double Click ESdyf
&rnfjzpfonf/ Microsoft Visual Basic 6.0 rwyfqif&ao;aom uGefysLwmrsm;wGif
vnf; Install vkyNf y;D ygu Run í&Edkifayonf/

---------------0-0-0---------------
393 Microsoft Visual Basic 6.0

tjcm;uGeyf sLwmrsm;odYk jyefvnf Install jyKvkyfjcif;


327/ yH(k 447)wGiaf wGUjrifae&aom zdik rf sm;udk Compact Disc (CD) jzifah omfvnf;
aumif;? Diskette jzifhaomfvnf;aumif;ul;,lí tjcm;uGefysLwmpufwpfvHk;odkY Install
jyKvkyfEdkifayonf/ tqdkygzdkifrsm;xJrS Setup.exe udk Double Click ESyd yf g/ yH(k 448)yg
twdkif;jrifawGU&rnf/ OK Command Button udka½G;cs,f&rnf/

yHk(448)

328/ aemufxyf Dialog Box wpfckxyfrHay:vmrnf/ yHk(449)/


uGefysLwmvufpJG 394

yHk(449)

329/ uGefysLwmyHkygaom Command Button tm;a½G;cs,fygu C:\Program


Files\ Project1 xJwGif Install jyKvkyfrnfjzpfNyD;tjcm;vrf;aMumif;ajymif;vJí Install
vkyv f ykd gu Change Directory udak ½G;írdrEd pS o
f uf&mvrf;aMumif;ajymif; Install jyKvyk f
Edik af yonf/ xdaYk Mumifh uGeyf sLwmyHyk gaom Command Button tm;a½G;cs,yf g/ yH(k 450)yg
Dialog Box wpfckxyfrHay:vmrnf/
395 Microsoft Visual Basic 6.0

yHk(450)
330/ Continue Command Button udka½G;cs,f&rnf/ y½dk*&rfrsm;tm; Install
vkyfNyD;ygu yHk(451)ygtwdkif; atmifjrifpGmNyD;qHk;aMumif; Message Box ay:vmygu
OK udk Click vky& f efjzpfygonf/

yHk(451)
uGefysLwmvufpJG 396

331/ y½d*k &rfrsm;onf uGeyf sLwmxJwiG f C:\Program Files\Project1 vrf;aMumif;


atmufodkYa&muf½SdoGm;onfudk My Computer Short Icon tqifq h ifu
h akd ½G;cs,jf cif;jzifh
jrifawGU Edkifayonf/ yHk(452)/

yHk(452)

332/ tqdyk g extest111.exe zdkifudk Run ygu y½d*k &rftouf0ifrnfjzpfonf/


---------------0-0-0---------------
InputBox a&;xHk;jzifh Password jyKvkyfjcif;
333/ InputBox a&;xH;k jzifh Password jyKvy
k &f eftwGuf yH(k 453)wGiaf zmfjyxm;onfh
Form zdi
k w
f pfcu
k w
kd nfaqmufyg/

yHk(453)

334/ yHk(453)yg Form zd k i f w G i f Label, Timer, Command Button wdkYjzifh


wnfaqmufxm;NyD; vdktyfaom Properties rsm;udkjyifqifí y½dk*&rfrsm;udka&;om;&
ayrnf/
397 Microsoft Visual Basic 6.0

335/ Label1 - Label Properties twGuf-


(u) (Name) - Label1
( c) Alignment - 2 - Center
( *) AutoSize - False
(C) BackColor - &H80000018&
( i) BackStyle - 1 - Opaque
( p) BorderStyle- 1 - Fixed Single
(q) ForeColor - &H80000002&

336/ Command1 - Command Button Properties rSm -


(u) (Name) - Command1
( c) Caption - E&xit
( *) Font - MS Sans Serif, Regular, 8

337/ Timer1 - Timer Properties rSm -


(u) (Name) - Timer1
( c) Enabled - True
( *) Index - Empty
(C) Interval - 100
( i) Left - 3960
( p) Tag - Empty
(q) Top - 1920

338/ Exit Command Button twGuf-


Private Sub Command1_Click()
Unload Me
End
End Sub

339/ Form Load twGuf-


Private Sub Form_Load()
Dim Pw, Pword
a=1
Pw = "Naing"
Do While a <= 3
Pword = InputBox("Type in your password", "Password")
uGefysLwmvufpJG 398
If Pword <> Pw Then
MsgBox "Sorry, incorrect password"
Else
Exit Sub
End If
a=a+1
Loop
End
End Sub

340/ Timer1_Timer() twGuf-


Private Sub Timer1_Timer()
Dim i As Integer
Label1.BackColor = &H80000018
Label1.ForeColor = blue
Label1.Caption = Now
End Sub

341/ txufygy½dk*&rfudk Run ygu yH(k 454)ygtwdik ;f jzpfay:vmrnf/

yHk(454)

342/ InputBox a&;xH;k jzifah &;xm;ojzifh yxrOD;pGm Password awmif;onfh Input


Box ay:vmrnf/ rdrdrS Password udkrSefuefpGm½dkufESdyfEdkifygu wpfBudrfwnf;y½dk*&rf
Run rnfjzpfonf/ Password (3)Budrf½dkufírSefuefrIr½Sdygu y½dk*&rfxJrSxGufoGm;vdrfh
rnf/ 3 BudrftwGif; Password wpfcgr[kww f pfcgrSeu
f efr½I rdS o
S m y½d*k &rf Run rnfjzpf
onf/ yxrtBudrfwGif naing [k½dkufESdyfNyD; Enter odkYr[kwf OK Command Button
udak ½G;cs,yf guyH(k 455)ygtwdik ;f Message Box wpfcjk zifjh yrnfjzpfonf/ Enter odrYk [kwf
OK Command Button udka½G;cs,fyg/
399 Microsoft Visual Basic 6.0

yHk(455)

343/ xdktcg Input Box aemufwpfzefjyefay:vmygu Password trSefudk


jznfhpGufí Enter (odkYr[kwf) OK Command Button udka½G;cs,f&rnf/ yHk(456)/

yHk(456)

344/ xdt
k cg y½d*k &rf Run vmrnfukd yH(k 457)ygtwdik ;f jrifawGUEdik af yonf/ y½d*k &rfrS
xGuvf ykd gu Exit Command Button udka½G;cs,f&rnf/

yHk(457)

---------------0-0-0---------------
uGefysLwmvufpJG 400

omrefa&;xHk;jzifh Password jyKvkyfjcif;


345/ omrefa&;xHk;jzifh Password jyKvkyf&eftwGuf yHk(458)wGifazmfjyxm;onfh
Form zdi
k w
f pfcu
k w kd nfaqmufyg/

yHk(458)

346/ yHk(458)yg Form zdkifwGif Label, Text Box, Command Button wdkYjzifh
wnfaqmufxm;Ny;D vdt
k yfaom Properties rsm;udjk yifqifí y½d*k &rfrsm;udak &;om;&ay
rnf/
347/ Label1 - Label Properties twGuf-
(u) (Name) - Label1
( c) Alignment - 0 - Left Justify
( *) AutoSize - True
(C) BackColor - &H8000000F&
( i) BackStyle - 0 - Transparent
( p) BorderStyle - 0 - None
(q) Caption - Enter Password = = = >
( Z) ForeColor - &H80000012&

348/ Command1 - Command Button Properties rSm -


(u) (Name) - Command1
( c) Caption - &Run
( *) Font - MS Sans Serif, Regular, 8
401 Microsoft Visual Basic 6.0

349/ Run Command Button twGuf-


Private Sub Command1_Click()
Dim Pw, Pword
Pw = "Naing"
Pword = Text1.Text
If Pword <> Pw Then
Label2.Caption = "Sorry, incorrect password"
Else
Form1.Hide
Form2.Show
End If
End Sub

350/ Form Load twGuf-


Private Sub Form_Load()
If Text1.PasswordChar = "" Then
Text1.PasswordChar = "*"
Else
Text1.PasswordChar = ""
End If
End Sub

351/ Password rSefuefrI½Sdyguaemufxyf Form zdkifwpfckay:vmap&eftwGuf


xyfrH í Form zdkifwpfckwnfaqmuf&rnf/ yHk(459)/

yHk(459)
uGefysLwmvufpJG 402

352/ yHk(459)yg Form zdkifwGif Text Box, Timer, Command Button wdkYjzifh
wnfaqmufxm;Ny;D vdt
k yfaom Properties rsm;udjk yifqifí y½d*k &rfrsm;udak &;om;&ay
rnf/
353/ Text1 - TextBox Properties twGuf-
(u) (Name) - Text1
( c) Alignment - 2 - Center
( *) AutoSize - True
(C) BorderStyle- 1 - Fixed Single
( i) Font - MS Sans Serif, Regular, 14
( p) Text - Empty

354/ Text2 - TextBox Properties twGuf-


(u) (Name) - Text2
( c) Alignment - 2 - Center
( *) AutoSize - True
(C) BorderStyle- 1 - Fixed Single
( i) Font - MS Sans Serif, Regular, 14
( p) Text - Empty

355/ Timer1 - Timer Properties rSm -


(u) (Name) - Timer1
( c) Enabled - True
( *) Index - Empty
(C) Interval - 100
( i) Left - 960
( p) Tag - Empty
(q) Top - 1800

356/ Command1 - Command Button Properties rSm -


(u) (Name) - Command1
( c) Caption - E&xit
( *) Font - MS Sans Serif, Regular, 8
403 Microsoft Visual Basic 6.0

357/ Exit Command Button twGuf-


Private Sub Command1_Click()
Unload Me
End
End Sub

358/ Form Load twGuf-


Private Sub Form_Load()
Text1.Text = Time$
Text2.Text = Date$
End Sub

359/ Timer1_Timer() twGuf-


Private Sub Timer1_Timer()
Text1.Text = Time$
End Sub

360/ yH(k 458)yg Form zdkifudk Run ygu yH(k 460)ygtwdik ;f jzpfay:vmrnf/

yHk(460)

361/ Text Box wGif rdrdtaejzifh jzpfEdkifonfxifonfh pmom;udk½dkuf&rnf/ Oyrm


- Maung [k½u kd yf g/ Text Box wGif Asterisk (*) rsm;omay:vmrnf/ Run Com-
mand Button udka½G;onfjzpfap? Alt+R udka½G;onfjzpfap Password rSefuefrI½SdrSom
y½dk*&rf Run rnfjzpfonf/ Password rrSeu f efygu yH(k 461)ygtwdik ;f jyovdrrhf nf/
uGefysLwmvufpJG 404

yHk(461)

362/ Password udr k eS u


f efpmG ½du
k rf xnfEh ikd yf gu y½d*k &rfxo
J v
Ykd ;kH 00ifciG jhf yKrnf r[kwf
bJ Password rSeu f efr½I rdS oS m aemuf Form wpfco k q
Ykd ufvuftvkyv f yk rf nfjzpfygonf/
xdkYaMumifhy½dk*&rfxJwGifowfrSwfxm;aom Password jzpfaom Naing udk jznfhpGufNyD;
Enter odrYk [kwf OK Command Button udak ½G;cs,yf g/ yH(k 462)ygtwdik ;f jzpfay:vmrnf/
y½dk*&rfxJrSxGufvdkygu Exit Command Button udak ½G;cs,yf g/

yHk(462)

---------------0-0-0---------------
405 Microsoft Visual Basic 6.0

Chapter (12)

Microsoft Internet Explorer wGif HTML zdkifrsm;udkqJG,ltoHk;jyKjcif;


363/ yxrOD;pGm Microsoft Internet Explorer wGif Run í&Edkifap&ef HTML
(Hyper Text Mark-Up Language) jzifh y½dk*&rfrsm;udk a&;om;&rnf/ Oyrm -
c:\html_notes vrf;aMumif;xJwGif rdrdtvdk½Sdonfh HTML zdkifrsm;a&;om;xm;&rnf/

364/ Index.htm zdkiftwGuf-


<html>
<head>
<title> My Home Page (Index File) </Title></head>
<frameset rows="60,*">
<frame name="banner" scrolling="no" noresize target ="contents"
src="header.htm">
<frameset cols="185,*">
<frame name="contents" target="main" src="content.htm">
<frame name="main" src="main.htm" target="contents">
</frameset>
</frameset>
</html>

365/ header.htm zdkiftwGuf-


<html>
<head><title>Web Page Header</Title>
<base target="contents"></head>
<body>
<p align="center"><b><big><big>
<marquee align="middle" behavior="alternate" direction="right"> Welcome
to My Home Page</marquee>
</big></big></b></p>
</body>
</html>

366/ content.htm zdkiftwGuf-


<html>
<head><title> Content </Title>
uGefysLwmvufpJG 406
<base target="main"></head>
<body>
<p><b><font color="#0000ff">HTML Lessons</font></b></p>
<p><b>
1. <a href="Heading.htm"> Heading</a><br>
2. <a href="HRuler2.htm"> Horizontal Ruler</a><br>
3. <a href="Format.htm"> Text Format</a><br>
4. <a href="Font Size.html"> Font Size</a><br>
5. <a href="Font Color.html"> Font Color</a><br>
6. <a href="Font Face.html"> Font Face</a><br>
7. <a href="bgsound.htm"> BGSound </a><br>
8. <a href="BGColorCode.htm"> BGColorCode</a><br>
9. <a href="Font attrs.html"> Font Attr. </a><br>
10. <a href="FontType.html"> Font Type</a><br>
11. <a href="Format.htm"> Text Format</a><br>
12. <a href="Paragraph.htm"> Paragraph </a><br>
13. <a href="Form-Table1.htm"> Form Table </a><br>
14. <a href="Images.htm"> Images </a><br>
15. <a href="ImageTable.htm">Image Table </a><br>
16. <a href="Table1.htm"> Table1 </a><br>
17. <a href="Video.htm"> Video </a><br>
18. <a href="VBScript.htm"> VBScript </a><br>
19. <a href="Javascript.htm"> Javascript </a><br>
20. <a href="HTML_Option.htm">HTML Option </a><br><br>
21. <a href="Thanks.htm">Thank You </a></b></p>
** <a href="Exercise001.htm"> Excercise001 </a><br>
** <a href="Java_TextTyper.htm"> Java_TextTyper </a><br>
<b> Links to Other Site (Applet Effects) </b> <Br>
* <a href="C:\My Documents\JavaScripts 99\javaapplets\imageeffects\
durius\water3.html"> Water </a><br>
* <a href="C:\My Documents\JavaScripts 99\javaapplets\imageeffects\
durius\water3.html"> Water2 </a><br>
* <a href="C:\My Documents\JavaScripts 99\javaapplets\imageeffects\
durius\water3.html"> Water3 </a><br>
* <a href="C:\My Documents\JavaScripts 99\javaapplets\imageeffects\
durius\Bump.html">Bump </a><br>
407 Microsoft Visual Basic 6.0

* <a href="C:\My Documents\JavaScripts 99\javaapplets\imageeffects\


durius\Bump2.html"> Bump2 </a><br>
* <a href="C:\My Documents\JavaScripts 99\javaapplets\imageeffects\
durius\Bump3.html"> Bump3 </a><br>
* <a href="C:\My Documents\JavaScripts 99\javaapplets\imageeffects\
durius\Lens.html"> Lens </a><br>
* <a href="C:\My Documents\JavaScripts 99\javaapplets\imageeffects\
durius\Lens2.html"> Lens2 </a><br>
* <a href="C:\My Documents\JavaScripts 99\javaapplets\imageeffects\
durius\Lens3.html"> Lens3 </a><br>
</body>
</html>

367/ main.htm zdkiftwGuf-


<html>
<head><title>Main Area in Frame Page</Title>
<base target="contents"></head>
<body>
<p></p> <p></p> <p></p>
<p align="center"><font color ="0000ff"><b><big>A Practical Application
</b></big></p>
<p align="center"><big><b><font color ="ff0000">of</font></b></big>
</p>
<p align="center"><big><b><font color ="0000ff">&nbsp;HTML Basic
Lessons</font></b></big></p>
<p></p>
</body>
</html>

368/ heading.htm zdkiftwGuf-


<html>
<head><title>Heading Text Styles
</Title></head>
<body>
<H1>Heading 1 </H1>
<H2>Heading 2 </H2>
<H3>Heading 3 </H3>
uGefysLwmvufpJG 408
<H4>Heading 4 </H4>
<H5>Heading 5 </H5>
<H6>Heading 6 </H6>
<H7>Normal Size </H7>
</body>
</html>

369/ hruler2.htm zdkiftwGuf-


<html>
<head><title>Horizontal Ruler</Title></head>
<body>
<hr color="blue">
<hr color="red" width ="75%">
<hr color=blue size=10 width=100>
<hr color=green size=25 width=200>
</body>
</html>

370/ format.htm zdkiftwGuf-


<html>
<head><title>Text Formatting</Title></head>
<body>
<Center>
<!-- Remark -->
<B>Bold Text Bold Text Bold Text</b><br>
<U>Underlined Text Underlined Text Underlined Text</u><br>
<I>Italic Text Italic Text Italic Text</i><br>
</Center>
</body>
</html>

371/ font size.html zdkiftwGuf-


<html>
<head><title>Font Size</Title></head>
<body>
<Font Size=1> Font Size =1 </font><br>
<Font Size=2> Font Size =2 </font><br>
409 Microsoft Visual Basic 6.0

<Font Size=3> Font Size =3 </font><br>


<Font Size=4> Font Size =4 </font><br>
<Font Size=5> Font Size =5 </font><br>
<Font Size=6> Font Size =6 </font><br>
<Font Size=7> Font Size =7 </font><br>
</body>
</html>

372/ font color.html zdkiftwGuf-


<html>
<head><title>Font Color</Title></head>
<body><b><h1>
<Font Color=red> Font Color=red </font><br>
<Font Color=green> Font Color=green </font><br>
<Font Color=blue> Font Color=blue </font><br>
<Font Color=yellow> Font Color=yellow </font><br>
<Font Color=cyan> Font Color=cyan </font><br>
<Font Color=silver> Font Color=silver </font><br>
<Font Color=lime> Font Color=lime </font></b>
<p><b><font face="Arial" size="3" color="#0000FF">This is arial font.
</font><br></b></p>
</h1>
</body>
</html>

373/ font face.html zdkiftwGuf-


<html>
<head><title>Font Face</Title></head>
<body><b>
<Font size=7>
<Font face=times>face=times</font><br>
<Font face=arial>face=arial</font><br>
<Font face=times new roman>face=times new roman</font><br>
<Font face=arial black>face=arial black</font><br>
<Font face="-win---kalaw"> pmvkH;=0if;uavm</font><br>
<Font face="-win---researcher"> pmvkH;=0if;uavm</font><br>
<Font face=Haettenschweiler>face=Haettenschweiler</font><br>
uGefysLwmvufpJG 410
</Font>
</b>
</body>
</html>

374/ bgsound.htm zdkiftwGuf-


<html>
<head><title>Background Sond is playing (Another Directory)</Title>
</head>
<body>
<bgsound src="c:\windows\wzz.mp3" loop="-1">
<h1>Background Sound is playing ... </h1>
</body>
</html>

375/ BGColorCode.htm zdkiftwGuf-


<html>
<head><title>Background Color Code</Title></head>
<body BGCOLOR="#00ff00">
<h1>BGCOLOR is Green ... (Code)</h1>
</body>
</html>

376/ font attrs.html zdkiftwGuf-


<html>
<head><title>Other Font Attributes</Title></head>
<body>
This is normal text on body<br>
<strong>Strong Text</strong><br>
<strong><strong>Strong and strong Text</strong></strong><br>
<strike>Strike through on Text</strike><br>
<big>Big Text</big><br>
<big><big>Big and big Text</big></big><br>
<small>Small Text</small><br>
<small><small>Small and small Text</small></small><br>
<h3>Super Script and Subscript<br>
H<sub>2</sub>O<br>
411 Microsoft Visual Basic 6.0

X<sup>2</sup>+y-10</h3><br>
<tt>This is a Monotype Text Style. This is a Monotype Text Style, This is a
Monotype Text Style, This is a Monotype Text Style. </tt>
</body>
</html>

377/ fontType.html zdkiftwGuf-


<html>
<head><title>Font Type</Title></head>
<body><pre>
1. Pre-formated
2. Pre-formated
Pre-formated Pre-formated</pre>
<acronym>Acronym Acronym Acronym </acronym><br>
<address>Address Address Address </address><br>
<blockquote>BlockQuote BlockQuote BlockQuote </blockquote><br>
<cite>Cite Cite Cite </cite><br>
<del>Del Del Del </del><br>
<dfn>Defination Defination Defination </dfn><br>
<em>Em Em Em </em><br>
<ins>Insert Insert Insert </ins><br>
<textarea cols=50 rows=10 name="area1"> This is text area. This is text
area. This is text area. This is text area. This is text area. This is text area.
This is text area. This is text area. This is text area. This is text area. This is
text area. This is text area. This is text area. This is text area. This is text
area. This is text area. This is text area. This is text area. This is text area.
This is text area. This is text area. This is text area.This is text area. This is
text area. This is text area. This is text area. This is text area. This is text
area. This is text area. This is text area. This is text area. This is text area.
This is text area. This is text area. This is text area. This is text area. This is
text area. This is text area. This is text area. This is text area. This is text
area. This is text area. This is text area. This is text area.
</textarea>
</body>
</html>
uGefysLwmvufpJG 412

378/ format.htm zdkiftwGuf-


<html>
<head><title>Text Formatting</Title></head>
<body>
<Center>
<!-- Remark -->
<B>Bold Text Bold Text Bold Text</b><br>
<U>Underlined Text Underlined Text Underlined Text</u><br>
<I>Italic Text Italic Text Italic Text</i><br>
</Center>
</body>
</html>

379/ Paragraph.htm zdkiftwGuf-


<html>
<head><title>Sparating Paragraphs</Title></head>
<body><p>
Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1
Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Para-
graph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Para-
graph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Para-
graph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1</p>
<p align="center"> Paragraph1 Paragraph1 Paragraph1 Paragraph1 Para-
graph1 Paragraph1
Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Para-
graph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Para-
graph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Para-
graph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Para-
graph1 Paragraph1 Paragraph1 Paragraph1
</p>
</body>
</html>

380/ Form_table1.htm zdkiftwGuf-


<HTML>
<HEAD> <TITLE>JavaScript & Forms</TITLE> </HEAD>
<BODY>
413 Microsoft Visual Basic 6.0

<Center>
<SCRIPT LANGUAGE="JavaScript">
<!-- begining of script
function CalcTotals() {

var p1_Float = parseFloat(document.Form1.Price1.value);


var p2_Float = parseFloat(document.Form1.Price2.value);
var p3_Float = parseFloat(document.Form1.Price3.value);
var q1_Float = parseFloat(document.Form1.Quantity1.value);
var q2_Float = parseFloat(document.Form1.Quantity2.value);
var q3_Float = parseFloat(document.Form1.Quantity3.value);
var Total = 0;

document.Form1.SubTotal1.value = q1_Float*p1_Float;
document.Form1.SubTotal2.value = q2_Float*p2_Float;
document.Form1.SubTotal3.value = q3_Float*p3_Float;
document.Form1.Total.value = (q1_Float*p1_Float)+
(q2_Float*p2_Float) + (q3_Float*p3_Float);}

<!-- end of script --></SCRIPT>

<FORM NAME="Form1">

<TABLE WIDTH="600">

<TR>
<TH VALIGN="TOP" ALIGN="CENTER">No.</TH>
<TH VALIGN="TOP" ALIGN="CENTER">Rank</TH>
<TH VALIGN="TOP" ALIGN="CENTER">Pay </TH>
<TH VALIGN="TOP" ALIGN="CENTER">Amount of Soldier</TH>
<TH VALIGN="TOP" ALIGN="CENTER">Total Pay</TH>
</TR>

<TR>
<TD VALIGN="TOP" ALIGN="CENTER">1.</TD>
<TD VALIGN="TOP" ALIGN="CENTER">Sgt</TD>
uGefysLwmvufpJG 414
<TD ALIGN="CENTER">Ks 100.75<INPUT TYPE="HIDDEN"
NAME="Price1" VALUE="100.75"></TD>
<TD ALIGN="CENTER"><INPUT TYPE="TEXT"
NAME="Quantity1"></TD>
<TD ALIGN="RIGHT"><INPUT TYPE="TEXT" NAME="SubTotal1">
</TD>
</TR>

<TR>
<TD VALIGN="TOP" ALIGN="CENTER">2.</TD>
<TD VALIGN="TOP" ALIGN="CENTER">Cpl.</TD>
<TD ALIGN="CENTER">Ks&nbsp;&nbsp;&nbsp;95.25
<INPUT TYPE="HIDDEN" NAME="Price2" VALUE="95.25"> </TD>
<TD ALIGN="CENTER"><INPUT TYPE="TEXT"
NAME="Quantity2"></TD>
<TD ALIGN="RIGHT"><INPUT TYPE="TEXT" NAME="SubTotal2">
</TD>
</TR>

<TR>
<TD VALIGN="TOP" ALIGN="CENTER">3.</TD>
<TD VALIGN="TOP" ALIGN="CENTER">Rfm.</TD>
<TD ALIGN="CENTER">Ks&nbsp;&nbsp;&nbsp;80.50
<INPUT TYPE="HIDDEN" NAME="Price3" VALUE="80.50"></TD>
<TD ALIGN="CENTER"><INPUT TYPE="TEXT"
NAME="Quantity3"></TD>
<TD ALIGN="RIGHT"><INPUT TYPE="TEXT" NAME="SubTotal3">
</TD>
</TR>

<TR>
<TD VALIGN="TOP" ALIGN="CENTER" COLSPAN="5"><HR></TD>
</TR>

<TR>
<TD VALIGN="TOP" ALIGN="CENTER"></TD>
415 Microsoft Visual Basic 6.0

<TD VALIGN="TOP" ALIGN="CENTER"></TD>


<TD ALIGN="CENTER"></TD>
<TD ALIGN="RIGHT">Total Kyats</TD>
<TD ALIGN="RIGHT"><INPUT TYPE="TEXT" NAME="Total"></TD>
</TR>

<TR>
<TD VALIGN="TOP" ALIGN="CENTER"></TD>
<TD VALIGN="TOP" ALIGN="CENTER"></TD>
<TD ALIGN="CENTER"></TD>
<TD ALIGN="CENTER"></TD>
<TD ALIGN="RIGHT">
<INPUT TYPE="BUTTON" NAME="Button1" VALUE="Recalculate"
ONCLICK="CalcTotals()"></TD>
</TR>

</TABLE>
</FORM>
</Center>
</BODY>
</HTML>

381/ Images.htm zdkiftwGuf-


<html>
<head><title>Using Miage Tags</Title></head>
<body>
<center>
<img src="ace.gif" alt="ace.gif">
<img src="./Images/111.jpg" width=200 height=200 border=10 hspace=10
vspace=10 Alt="This is 111.jpg" align="center">
<img src="./Images/222.jpg" Height=300 width=175 alt="222.gif"><br>
</center>
</body>
</html>
uGefysLwmvufpJG 416

382/ ImageTable.htm zdkiftwGuf-


<html>
<head><title> Table and Images </Title></head>
<body>
<Center>
<Table Border = "1" Width="70">
<tr>
<td> <Img src="./Images/pict01.gif" width=120 height=100 alt="Picture1">
</td>
<td> <Img src="./Images/pict02.gif" width=120 height=100 alt="Picture2">
</td>
<td> <Img src="./Images/pict03.gif" width=120 height=100 alt="Picture3">
</td>
</tr>
<tr>
<td> <Img src="./Images/pict04.gif" width=120 height=100 alt="Picture4">
</td>
<td> <Img src="./Images/pict05.gif" width=120 height=100 alt="Picture5">
</td>
<td> <Img src="./Images/pict06.gif" width=120 height=100 alt="Picture6">
</td></tr>
<tr>
<td> <Img src="./Images/pict07.gif" width=120 height=100 alt="Picture7">
</td>
<td> <Img src="./Images/pict08.gif" width=120 height=100 alt="Picture8">
</td>
<td> <Img src="./Images/pict09.gif" width=120 height=100 alt="Picture9">
</td>
</tr>
</table>
<br>
<b> <Font color=red size=6 face="NuptialScript"> Image Table </Font> </
b>
</Center>
</body>
</html>
417 Microsoft Visual Basic 6.0

383/ Table1.htm zdkiftwGuf-


<html>
<head><title> Table Cells </Title></head>
<body>
<Table Border = "20" Width="500" cellpadding="5" cellspacing="10"
bordercolor="purple" align="center" bgcolor="silver">
<tr>
<td align="center">Cell1</td>
<td align="center">Cell2</td>
</tr>
<Table Border = "20" Width="300" cellpadding="3" cellspacing="10"
bordercolor="red" align="center" bgcolor="silver">
<tr>
<td align="right">Cell3</td>
<td>Cell4</td>
</tr>
<Table Border = "20" Width="400" cellpadding="3" cellspacing="10"
bordercolor="blue" align="center" bgcolor="silver">
<tr>
<td>Cell5</td>
<td>Cell6</td>
</tr>
<Table Border = "20" Width="300" cellpadding="3" cellspacing="10"
bordercolor="magenta" align="center" bgcolor="silver">
<tr>
<td>Cell7</td>
<td>Cell8</td>
</tr>
</table>
</body>
</html>

384/ Video.htm zdkiftwGuf-


<html>
<head><title>Video is playing (Another Directory)</Title></head>
<body>
uGefysLwmvufpJG 418
<center>
<img dynsrc="c:\my documents\Music12.dat">
<h1>Video is playing ... </h1>
</center>
</html>

385/ VBScript.htm zdkiftwGuf-


<HTML>
<HEAD> <TITLE>VBScript & Form Example</TITLE> </HEAD>
<BODY BGCOLOR="#FFFFFF">

<SCRIPT LANGUAGE="VBScript">
<!-- begining of script

Sub add_2_num()

a_str = document.Form1.Text1.value
b_str = document.Form1.Text2.value
a_int = cint(a_str)
b_int = cint(b_str)
c=0
c = a_int+b_int
MsgBox "The answer is: " & c
End Sub

<!-- end of script --></SCRIPT>

<FORM NAME="Form1">

<P>A=<INPUT TYPE="TEXT" NAME="Text1"><BR>


B = <INPUT TYPE = "TEXT" NAME = "Text2"><BR>
<INPUT TYPE = "BUTTON" NAME = "Button1" VALUE = "A+B="
ONCLICK = "add_2_num()"></p>

</FORM>
</BODY>
</HTML>
419 Microsoft Visual Basic 6.0

386/ Javascript.htm zdkiftwGuf-


<HTML>
<HEAD> <TITLE>JavaScript & Forms</TITLE> </HEAD>
<BODY>

<SCRIPT LANGUAGE="JavaScript">
<!-- begining of script

function add_2_num() {

var a_str = document.Form1.Text1.value;


var b_str = document.Form1.Text2.value;
var a_int = parseInt(a_str);
var b_int = parseInt(b_str);
var c = 0;

c = a_int + b_int;
alert("The answer is: " +c);}

<!-- end of script --></SCRIPT>

<FORM NAME="Form1">

<P>A = <INPUT TYPE = "TEXT" NAME = "Text1"><BR>


B = <INPUT TYPE = "TEXT" NAME = "Text2"><BR>
<INPUT TYPE = "BUTTON" NAME = "Button1" VALUE = "A+B="
ONCLICK="add_2_num()"></p>

</FORM>
</BODY>
</HTML>

387/ HTML_Option.htm zdkiftwGuf-


<HTML><HEAD><TITLE>MyPage</TITLE></head>
<BODY BGCOLOR=FFFFFF TEXT=000000>

<CENTER>
uGefysLwmvufpJG 420
<Font color=red>
<H1>HTML_Option</H1>
</Font>
<H2>This is Heading 2 Style</H2>
<br>
<SELECT NAME=Selection1>

<OPTION>
<a href="FontFace.html"> Font Face </a>
</OPTION>
<OPTION>
<a href="FontSize.html"> Font Size </a>
</OPTION>
<OPTION>
<a href="FontColor.html"> Font Color </a>
</OPTION>

</SELECT>
<br><br>
<TEXTAREA NAME=mytext ROWS=10 COLS=50>
This word is in the text area.
</TEXTAREA>
</CENTER>
</BODY>
</HTML>

388/ Thanks.htm zdkiftwGuf-


<html>
<head><title>Thanks</Title></head>
<body bgcolor="#000000">
<center>
<a href="main.htm"><Img Src="./Images/Home.gif" width="220"
height="197"></a><br>
<font color =red>
<h1>Thank your for Visit to My Home Page</h1></font></center>
</body>
</html>
421 Microsoft Visual Basic 6.0

389/ Exercise001.htm zdkiftwGuf-


<HTML>
<HEAD> <TITLE>JavaScript & Forms (Fahrenheit to Centigrade)</TITLE>
</HEAD>
<BODY>
<center>
<SCRIPT LANGUAGE="JavaScript">
<!-- begining of script

function CTs() {

var fah=parseFloat(document.Form1.P1.value);
var cen = 0;

document.Form1.cen.value=5/9*(fah-32);}

<!-- end of script --></SCRIPT>

<FORM NAME="Form1">

<H1><font color="green">Fahrenheit Degree to Centigrade Degree</font>


</H1><br>

<H2><font color="blue">Enter Fahrenheit Degree&nbsp;&nbsp;&nbsp;


&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp
<INPUT TYPE="TEXT" NAME="P1"><br>

Equivalent Centigrade Degree&nbsp<INPUT TYPE="TEXT"


NAME="cen"><br><br>

<INPUT TYPE="BUTTON" NAME="Button1" VALUE="Run"


ONCLICK="CTs()"></font></H2><br>

</FORM>
</center>
</BODY>
</HTML>
uGefysLwmvufpJG 422

390/ Java_TextTyper.htm zdkiftwGuf-


<HTML LANG="en">
<HEAD><title>TextTyper v2.5</title>
<META http-equiv="Content-Type" content="text/html; harset=iso-8859-1">
<LINK REL="email"
HREF="mailto:agent_teg@ThePentagon.com">

<style type="text/css">
<!--
B { font-weight: bold }
#ttl0 { position: absolute }
.ttl1 { font: 8pt Verdana, Arial, Helvetica, serif }
// -->
</style>
<script type="text/javascript" language="javascript">
<!--
/*
*/
var layers = document.layers, style = document.all, both = layers || style,
idme=908601;
if (layers) { layerRef = 'document.layers'; styleRef = ''; } if (style)
{layerRef = 'document.all'; styleRef = '.style'; }

function writeOnText(obj, str) {


if (layers) with (document[obj]) { document.open();
document.write(str); document.close(); }
if (style) eval(obj+'.innerHTML= str');
}

var dispStr = new Array("<b>Loading <font color=#00FF00>TextTyper


</font>...</b> &nbsp; &nbsp; &nbsp; &nbsp; <br> <br>
Sy s t e m&nbsp; V e r s i o n . . . . <font color=#00FF00>v2.5
</font> <br> <br> L i f e&nbsp; S u p p o r t . . . .
<font color=#00FF00>-ok</font> <br> <br> V i t a l &nbsp;
S y s t e m s . . . . <font color=#00FF00>-ok</font> <br> <br>
S a n i t y . . . . <font color=#FF0000> -Error </font>");
423 Microsoft Visual Basic 6.0

var overMe=0;

function txtTyper(str, idx, idObj, spObj, clr1, clr2, delay, plysnd) {


var tmp0 = tmp1 = '', skip = 0;
if (both && idx <= str.length) {
if (str.charAt(idx) == '<') { while (str.charAt(idx) != '>') idx++; idx++;
}
if (str.charAt(idx) == '&' && str.charAt(idx+1) != ' ') { while
(str.charAt(idx) != ';') idx++; idx++; }
tmp0 = str.slice(0,idx);
tmp1 = str.charAt(idx++);

if (overMe==0 && plysnd==1) {


if (navigator.plugins[0]) {
if (navigator.plugins["LiveAudio"][0].type=="audio/basic" &&
navigator.javaEnabled()) {
document.embeds[0].stop();
setTimeout("document.embeds[0].play(false)",100); }
} else if (document.all) {
ding.Stop();
setTimeout("ding.Run()",100);
}
overMe=1;
} else overMe=0;

writeOnText(idObj, "<span class="+spObj+">


<font color='"+clr1+"'>"+tmp0+"</font>
<font color='"+clr2+"'>"+tmp1+"</font></span>");
setTimeout("txtTyper('"+str+"', "+idx+", '"+idObj+"',
'"+spObj+"', '"+clr1+"', '"+clr2+"', "+delay+" ,
"+plysnd+")",delay);
}
}

function init() {
txtTyper(dispStr[0], 0, 'ttl0', 'ttl1', '#339933', '#99FF33', 50, 0);
uGefysLwmvufpJG 424
}

// -->
</script>

</HEAD>

<BODY bgcolor="#000000" text="#339933" link="#33FF00"


alink="#666666" vlink="#666666" onload="init()">
<div id=ttl0 class=ttl1></div>
<!--
<OBJECT id="ding" CLASSID="CLSID:05589FA1-C356-11CE-BF01-
00AA0055595A" WIDTH=0 HEIGHT=0>
<PARAM NAME="ShowDisplay" VALUE="0">
<PARAM NAME="ShowControls" VALUE="0">
<PARAM NAME="AutoStart" VALUE="0">
<PARAM NAME="FileName" VALUE="type.au">
<embed src="type.au" width="37" height="0" controls="playbutton"
hidden="true" autostart="false" alt="">
</OBJECT>
-->
</BODY>

</HTML>

391/ Water3.html zdkiftwGuf-


<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0">
<TITLE>The Water-applet!</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" LINK="#407890" VLINK="#50a088">

<BLOCKQUOTE>
<P align="center"><B><FONT SIZE="+1"><IMG SRC="Images/
HeadlineWater.jpg" WIDTH="79" HEIGHT="42" ALIGN="BOTTOM"
BORDER="0" NATURALSIZEFLAG="3"></FONT><font color
425 Microsoft Visual Basic 6.0

="#0000FF" SIZE="+1"><span style="background-color:


#00FF00">Activate
your mouse on the center area.</span></font></B></P>
</BLOCKQUOTE>

<P><CENTER><B><FONT SIZE="+1">
<APPLET WIDTH="190" HEIGHT="190" ALIGN="BOTTOM"
CODE="WaterApp.class" CODEBASE="./">
<PARAM NAME="dim" VALUE="6">
<PARAM NAME="dotsize" VALUE="6">
<PARAM NAME="logoheight" VALUE="200">
<PARAM NAME="image" VALUE="Images/fxlogo.gif">
<PARAM NAME="mouse" VALUE="1">
<PARAM NAME="noise" VALUE="0">
<PARAM NAME="col1" VALUE="ffff34">
<PARAM NAME="col2" VALUE="ff3434">
<PARAM NAME="col3" VALUE="ffffff">
<PARAM NAME="col4" VALUE="3434ff">
<PARAM NAME="col5" VALUE="34ffff">
<PARAM NAME="url" VALUE="http://www.xoom.com/">
<PARAM NAME="reg" VALUE="41774512">
</APPLET></FONT></B></CENTER></P>

<P><CENTER><A HREF="water.html" TARGET="_self">1</A>,


<A HREF="water2.html" TARGET="_self">2</A>.</CENTER>

</BODY>
</HTML>

392/ Bump.html zdkiftwGuf-


<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 Win">
<TITLE>The Bump Applet!</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" LINK="#6ba2bc" VLINK="#58a890"
ALINK="#50b090">
uGefysLwmvufpJG 426

<P><B><FONT SIZE="-1"><A HREF="../applets.html"


TARGET="_self">Back to the applet page</A></FONT></B></P>

<BLOCKQUOTE>
<P><B><FONT SIZE="+2"><IMG SRC="Images/HeadlineBump.jpg"
WIDTH="87" HEIGHT="42" ALIGN="BOTTOM" BORDER="0"
NATURALSIZEFLAG="3"></FONT></B></P>
</BLOCKQUOTE>

<P><CENTER>
<APPLET WIDTH="256" HEIGHT="256" ALIGN="BOTTOM"
CODE="BumpApp.class" CODEBASE="./">
<PARAM NAME="image" VALUE="Images/rot.jpg">
<PARAM NAME="lightsizex" VALUE="120">
<PARAM NAME="lightsizey" VALUE="120">
<PARAM NAME="ambiencer" VALUE="120">
<PARAM NAME="ambienceg" VALUE="120">
<PARAM NAME="ambienceb" VALUE="120">
<PARAM NAME="bumpheight" VALUE="255">
<PARAM NAME="light" VALUE="255">
<PARAM NAME="reg" VALUE="60563282">
</APPLET></CENTER></P>

<P><CENTER><A HREF="Bump2.html" TARGET="_self">2</A>,


<A HREF="Bump3.html" TARGET="_self">3</A>.</CENTER>

</BODY>
</HTML>

393/ Bump2.html zdkiftwGuf-


<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 Win">
<TITLE>The Bump Applet!</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" LINK="#6ba2bc" VLINK="#58a890"
427 Microsoft Visual Basic 6.0

ALINK="#50b090">

<P><B><FONT SIZE="-1"><A HREF="../applets.html"


TARGET="_self">Back to the applet page</A></FONT></B></P>

<BLOCKQUOTE>
<P><B><FONT SIZE="+2"><IMG SRC="Images/HeadlineBump.jpg"
WIDTH="87" HEIGHT="42" ALIGN="BOTTOM" BORDER="0"
NATURALSIZEFLAG="3"></FONT></B></P>
</BLOCKQUOTE>

<P><CENTER>
<APPLET WIDTH="230" HEIGHT="230" ALIGN="BOTTOM"
CODE="BumpApp.class" CODEBASE="./">
<PARAM NAME="image" VALUE="Images/inyourface.jpg">
<PARAM NAME="lightsizex" VALUE="85">
<PARAM NAME="lightsizey" VALUE="85">
<PARAM NAME="ambiencer" VALUE="80">
<PARAM NAME="ambienceg" VALUE="120">
<PARAM NAME="ambienceb" VALUE="140">
<PARAM NAME="bumpheight" VALUE="320">
<PARAM NAME="light" VALUE="720">
<PARAM NAME="reg" VALUE="60563282">

</APPLET></CENTER></P>

<P><CENTER><A HREF="Bump.html" TARGET="_self">1</A>,


<A HREF="Bump3.html" TARGET="_self">3</A>.</CENTER>

</BODY>
</HTML>

394/ Bump3.html zdkiftwGuf-


<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 Win">
<TITLE>The Bump Applet!</TITLE>
uGefysLwmvufpJG 428
</HEAD>
<BODY BGCOLOR="#ffffff" LINK="#6ba2bc" VLINK="#58a890"
ALINK="#50b090">

<P><B><FONT SIZE="-1"><A HREF="../applets.html"


TARGET="_self">Back to the applet page</A></FONT></B></P>

<BLOCKQUOTE>
<P><B><FONT SIZE="+2"><IMG SRC="Images/HeadlineBump.jpg"
WIDTH="87" HEIGHT="42" ALIGN="BOTTOM" BORDER="0"
NATURALSIZEFLAG="3"></FONT></B></P>
</BLOCKQUOTE>

<P><CENTER>
<APPLET WIDTH="300" HEIGHT="300" ALIGN="BOTTOM"
CODE="BumpApp.class" CODEBASE="./">
<PARAM NAME="image" VALUE="Images/bump.jpg">
<PARAM NAME="lightsizex" VALUE="175">
<PARAM NAME="lightsizey" VALUE="175">
<PARAM NAME="bumpheight" VALUE="370">
<PARAM NAME="light" VALUE="370">
<PARAM NAME="ambiencer" VALUE="140">
<PARAM NAME="ambienceg" VALUE="120">
<PARAM NAME="ambienceb" VALUE="100">
<PARAM NAME="reg" VALUE="60563282">
</APPLET></CENTER></P>

<P><CENTER><A HREF="Bump.html" TARGET="_self">1</A>,


<A HREF="Bump2.html" TARGET="_self">2</A>.</CENTER>

</BODY>
</HTML>

395/ Lens.html zdkiftwGuf-


<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 Win">
429 Microsoft Visual Basic 6.0

<TITLE>The Lens Applet!</TITLE>


</HEAD>
<BODY BGCOLOR="#ffffff" LINK="#6ba2bc" VLINK="#58a890"
ALINK="#50b090">

<P><B><FONT SIZE="-1"><A HREF="../applets.html"


TARGET="_self">Back to the applet page</A></FONT></B></P>

<BLOCKQUOTE>
<P><B><FONT SIZE="+2"><IMG SRC="Images/HeadlineLens.jpg"
WIDTH="74" HEIGHT="42" ALIGN="BOTTOM" BORDER="0"
NATURALSIZEFLAG="3"></FONT></B></P>
</BLOCKQUOTE>

<P><CENTER>
<APPLET WIDTH="300" HEIGHT="300" ALIGN="BOTTOM"
CODE="LensApp.class" CODEBASE="./">
<PARAM NAME="image" VALUE="Images/bump.jpg">
<PARAM NAME="depth" VALUE="3048">
<PARAM NAME="lenssizex" VALUE="400">
<PARAM NAME="lenssizey" VALUE="400">
<PARAM NAME="delay" VALUE="10">
<PARAM NAME="reg" VALUE="49605356">
</APPLET></CENTER></P>

<P><CENTER><A HREF="Lens2.html" TARGET="_self">2</A>,


<A HREF="Lens3.html" TARGET="_self">3</A>.</CENTER>

</BODY>
</HTML>

396/ Lens2.html zdkiftwGuf-


<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 Win">
<TITLE>The Lens Applet!</TITLE>
</HEAD>
uGefysLwmvufpJG 430
<BODY BGCOLOR="#ffffff" LINK="#6ba2bc" VLINK="#58a890"
ALINK="#50b090">

<P><B><FONT SIZE="-1"><A HREF="../applets.html"


TARGET="_self">Back to the applet page</A></FONT></B></P>

<BLOCKQUOTE>
<P><B><FONT SIZE="+2"><IMG SRC="Images/HeadlineLens.jpg"
WIDTH="74" HEIGHT="42" ALIGN="BOTTOM" BORDER="0"
NATURALSIZEFLAG="3"></FONT></B></P>
</BLOCKQUOTE>
<P><CENTER>
<APPLET WIDTH="300" HEIGHT="300" ALIGN="BOTTOM"
CODE="LensApp.class" CODEBASE="./">
<PARAM NAME="image" VALUE="Images/bump.jpg">
<PARAM NAME="depth" VALUE="-5000">
<PARAM NAME="lenssizex" VALUE="400">
<PARAM NAME="lenssizey" VALUE="400">
<PARAM NAME="delay" VALUE="1030">
<PARAM NAME="url" VALUE="http://www.kuk.com/">
<PARAM NAME="reg" VALUE="49605356">
</APPLET></CENTER></P>

<P><CENTER><A HREF="Lens.html" TARGET="_self">1</A>,


<A HREF="Lens3.html" TARGET="_self">3</A>.</CENTER>

</BODY>
</HTML>
431 Microsoft Visual Basic 6.0

397/ Lens3.html zdkiftwGuf-


<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 Win">
<TITLE>The Lens Applet!</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" LINK="#6ba2bc" VLINK="#58a890"
ALINK="#50b090">

<P><B><FONT SIZE="-1"><A HREF="../applets.html"


TARGET="_self">Back to the applet page</A></FONT></B></P>

<BLOCKQUOTE>
<P><B><FONT SIZE="+2"><IMG SRC="Images/HeadlineLens.jpg"
WIDTH="74" HEIGHT="42" ALIGN="BOTTOM" BORDER="0"
NATURALSIZEFLAG="3"></FONT></B></P>
</BLOCKQUOTE>

<P><CENTER>
<APPLET WIDTH="230" HEIGHT="230" ALIGN="BOTTOM"
CODE="LensApp.class" CODEBASE="./">
<PARAM NAME="image" VALUE="Images/inyourface.jpg">
<PARAM NAME="depth" VALUE="6048">
<PARAM NAME="lenssizex" VALUE="150">
<PARAM NAME="lenssizey" VALUE="150">
<PARAM NAME="delay" VALUE="10">
<PARAM NAME="reg" VALUE="49605356">
</APPLET></CENTER></P>

<P><CENTER><A HREF="Lens.html" TARGET="_self">1</A>,


<A HREF="Lens2.html" TARGET="_self">2</A>.</CENTER>

</BODY>
</HTML>
uGefysLwmvufpJG 432

398/ txufyg HTML zdik rf sm;tm; y½d*k &rfjzifq


h w
GJ if&eftwGuf Form zdik w
f pfcu
k kd
wnfaqmuf&rnf/

yHk(463)

399/ yH(k 463)yg Form zdkifwGif Timer, Label, Progress Bar wdkYjzifh wnfaqmuf
xm;NyD; vdktyfaom Properties rsm;udkjyifqifí y½dk*&rfrsm;udka&;om;&ayrnf/
400/ Timer1 - Timer Properties rSm -
(u) (Name) - Timer1
( c) Enabled - True
( *) Index - Empty
(C) Interval - 5000
( i) Left - 3480
( p) Tag - Empty
(q) Top - 0
433 Microsoft Visual Basic 6.0

401/ Label1 - Label Properties rSm -


(u) (Name) - Label1
( c) Alignment - 2 - Center
( *) AutoSize - False
(C) BackStyle - 1 - Opaque
( i) BorderStyle- 1 - Fixed Single
( p) Caption - uGefysLwmXme (uGefysLwmXme)
(q) Font - -Win---Taungyi, Bold, 36

402/ ProgressBar1 - ProgressBar Properties rSm -


(u) (Name) - ProgressBar1
( c) Align - 0 - vbAlignNone
( *) Max - 1000
(C) Min - 0
( i) Font - MS Sans Serif, Regular, 8

403/ Timer1 Timer() twGuf-


Private Sub Timer1_Timer()
Private Sub Timer1_Timer()
Dim n1 As Integer
For n1 = 1 To 1000
Form1.Caption = "Processing Step " & Trim$(CStr(n1)) & " of 1000"
ProgressBar1 = n1
Next n1
Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE
c:\html_notes\index.htm", 1)
End
End Sub
uGefysLwmvufpJG 434

404/ yH(k 463)yg Form zdkifudk Run ygu yH(k 464)ygtwdik ;f jzpfay:vmrnf/

yHk(464)

405/ acwåcP(Oyrm-5 puúefYcefY)Mumjrifhygu yHk(465)ygtwdkif;y½dk*&rf Run rnf


jzpfonf/ Time Interval tm; 5000 ay;xm;aomaMumifhjzpfonf/

yHk(465)

406/ Progress Bar wef;jynfo


h mG ;ygu yH(k 466)ygtwdik ;f Microsoft Internet Ex-
plorer ay:vmNyD; HTML jzifha&;om;xm;onfh y½dk*&rfrsm;udk toHk;csí&NyDjzpfonf/
tu,fí Microsoft Internet Explorer rSxu G v
f ykd gu Close Button udEk ydS &f rnf/
435 Microsoft Visual Basic 6.0

yHk(466)
uGefysLwmvufpJG 436

Chapter (13)

Application Package rsm;udky½dk*&rfjzifhzGifhjcif;


1/ Microsoft Visual Basic 6.0 jzifh Application Package rsm;udkqJGwif
vdyk gu atmufygtwdik ;f Form wpfckudkwnfaqmuf&rnf/ yHk(467)/

yHk(467)

2/ Form1 - Form Properties rSm -


(u) (Name) - Form1
( c) BorderStyle- 2 - Sizable
( *) Caption - Openning of the Application Package
(C) Font - MS Sans Serif, Regular, 8
( i) WindowState- 0 - Normal
3/ Command1 - Command Button Properties rSm -
(u) (Name) - Command1
( c) Caption - Open Microsoft &Word
( *) Font - MS Sans Serif, Regular, 8
4/ Command2 - Command Button Properties rSm -
(u) (Name) - Command2
( c) Caption - Open Microsoft &Excel
( *) Font - MS Sans Serif, Regular, 8
437 Microsoft Visual Basic 6.0

5/ Command3 - Command Button Properties rSm -


(u) (Name) - Command3
( c) Caption - Open Microsoft &Access
( *) Font - MS Sans Serif, Regular, 8
6/ Command4 - Command Button Properties rSm -
(u) (Name) - Command4
( c) Caption - Open Adobe &Page Maker 6.5
( *) Font - MS Sans Serif, Regular, 8
7/ Command5 - Command Button Properties rSm -
(u) (Name) - Command5
( c) Caption - E&xit
( *) Font - MS Sans Serif, Regular, 8
8/ Command1 - Command Button twGuf-
Private Sub Command1_Click()
Dim MyAppID
MyAppID = Shell("C:\Program Files\Microsoft Office\Office10\
WINWORD.EXE", 1)
End Sub

9/ Command2 - Command Button twGuf-


Private Sub Command2_Click()
Dim MyAppID
MyAppID = Shell("C:\Program Files\Microsoft Office\Office10\
EXCEL.EXE", 1)
End Sub

10/ Command3 - Command Button twGuf-


Private Sub Command3_Click()
Dim MyAppID
MyAppID = Shell("C:\Program Files\Microsoft Office\Office10\
MSACCESS.EXE", 1)
End Sub
uGefysLwmvufpJG 438

11/ Command4 - Command Button twGuf-


Private Sub Command4_Click()
Dim MyAppID
MyAppID = Shell("C:\PM65\PM65.EXE", 1)
End Sub

12/ Command5 - Command Button twGuf-


Private Sub Command5_Click()
Unload Me
End
End Sub
---------------0-0-0---------------
439 Microsoft Visual Basic 6.0

Chapter (14)
taxGaxG

Multiple List Box rsm;zefwD;jcif;


1/ atmufygtwdkif; Form wpfckudkwnfaqmuf&rnf/ yHk(468)/ 4if;wGif La-
bel, Text Box, Command Button wdjYk zifz
h efw;D xm;Ny;D oufqikd &f m Properties rsm;udk
jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udka&;om;
&rnf/

yHk(468)

2/ Lable1 Properties twGuf-


(u) (Name) - Label1
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - How many number?
3/ Lable2 Properties twGuf-
(u) (Name) - Label2
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - Enter each number = >
uGefysLwmvufpJG 440

4/ Text1 Text Box Properties twGuf-


(u) (Name) - Text1
( c) Alignment - 0 - Left Justified
( *) Index - Empty
(C) Locked - False
( i) Text - Empty

5/ Text2 Text Box Properties twGuf-


(u) (Name) - Text
( c) Alignment - 0 - Left Justified
( *) Index - 1
(C) Locked - False
( i) Text - Empty

6/ Command1 Command Button Properties twGuf-


(u) (Name) - Command1
( c) Caption - &Add (Text Box)
( *) Enabled - True
7/ Command2 Command Button Properties twGuf-
(u) (Name) - Command2
( c) Caption - E&xit
( *) Enabled - True
8/ Form1 Form Properties twGuf-
(u) (Name) - Form1
( c) Enabled - True
( *) Caption - Example Multiple Text Box
9/ Object: General, Proc: [Declaration] twGuf Dim a1, a2 As Inte-
ger [ka&;om;&rnf/

10/ Add (Text Box) - Command1 Button twGuf-


Private Sub Command1_Click()
a2 = Val(Text1)
If a1 = 0 Then a1 = 1
If a1 > a2 Then Exit Sub
a1 = a1 + 1
441 Microsoft Visual Basic 6.0

Text1.Locked = True
Load Text(a1)
b1 = Text(a1).Name 'Text(a1).Name="Text"
b2 = Text(a1).Index 'Text(a1).Index = a1+1
b1 = "Text"
b2 = a1 + 1
Text(a1).Locked = True
Text(a1).Top = Text(a1 - 1).Top + 400
Text(a1).Left = Text(a1).Left - 400
Text(a1).Visible = True
Print Text(a1), Text(a1).Name, Text(a1).Index
Text(a1) = Text(a1)
End Sub

11/ Exit - Command2 Button twGuf-


Private Sub Command2_Click()
Unload Me 'Unload this form
End
End Sub

12/ txufygy½dk*&rfudk Run ygu yHk(469)ygtwdkif;jrifawGU&rnfjzpfygonf/

yHk(469)

---------------0-0-0---------------
uGefysLwmvufpJG 442

Exchange Sort udk Visual Basic jzifha&;om;jcif;


13/ atmufygtwdkif; Form wpfckudkwnfaqmuf&rnf/ yHk(470)/ 4if;wGif La-
bel, Text Box, Command Button wdjYk zifz
h efw;D xm;Ny;D oufqikd &f m Properties rsm;udk
jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udk a&;om;
&rnf/

yHk(470)

14/ Lable1 Properties twGuf-


(u) (Name) - Label1
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - How many number?
15/ Lable2 Properties twGuf-
(u) (Name) - Label2
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - Enter each number = >
443 Microsoft Visual Basic 6.0

16/ Text1 Text Box Properties twGuf-


(u) (Name) - Text1
( c) Alignment - 0 - Left Justified
( *) Index - Empty
(C) Locked - False
( i) Text - Empty

17/ Text2 Text Box Properties twGuf-


(u) (Name) - Text
( c) Alignment - 0 - Left Justified
( *) Index - 1
(C) Locked - False
( i) Text - Empty

18/ Command1 Command Button Properties twGuf-


(u) (Name) - Command1
( c) Caption - &Add (Text Box)
( *) Enabled - True
19/ Command2 Command Button Properties twGuf-
(u) (Name) - Command2
( c) Caption - &Exchange Sort
( *) Enabled - True
20/ Command3 Command Button Properties twGuf-
(u) (Name) - Command3
( c) Caption - E&xit
( *) Enabled - True
21/ Form1 Form Properties twGuf-
(u) (Name) - Form1
( c) Enabled - True
( *) Caption - Exchange Sort (Ascending Order)
22/ Object: General, Proc: [Declaration] twGuf Dim num1, n, k(50)
As Integer [ky½dk*&rfa&;om;&efjzpfygonf/
uGefysLwmvufpJG 444

23/ Add (Text Box) - Command1 Button twGuf-


Private Sub Command1_Click()
n = Val(Text1)
Text1.Locked = True
If num1 = 0 Then num1 = 1
If num1 > n Then Exit Sub
num1 = num1 + 1
Load Text(num1)
b1 = Text(num1).Name 'Text(num1).Name="Text"
b2 = Text(num1).Index 'Text(num1).Index = num1+1
Text(num1).Locked = True
Text(num1).Top = Text(num1 - 1).Top + 400
Text(num1).Left = Text(num1).Left - 400
Text(num1).Visible = True
Print Text(num1), Text(num1).Name, Text(num1).Index
i = Text(num1).Index - 1
k(i) = Text(num1)
Print k(i), i
End Sub

24/ Exchange Sort - Command2 Button twGuf-


Private Sub Command2_Click()
Cls
For i = 1 To n - 1
For j = 1 To n - 1
If k(j) <= k(j + 1) Then GoTo 100
t = k(j): k(j) = k(j + 1): k(j + 1) = t
100 Next j
Next i
For x = 1 To n
Print k(x)
Next
End Sub
445 Microsoft Visual Basic 6.0

25/ Exit - Command3 Button twGuf-


Private Sub Command3_Click()
Unload Me
End
End Sub

26/ txufyg y½dk*&rfudk Run ygu yHk(471)ygtwdkif;jrifawGU&rnfjzpfygonf/

yHk(471)

---------------0-0-0---------------
uGefysLwmvufpJG 446

Counting Sort udk Visual Basic jzifha&;om;jcif;


27/ atmufygtwdkif; Form wpfckudkwnfaqmuf&rnf/ yHk(472)/ 4if;wGif La-
bel, Text Box, Command Button wdjYk zifz
h efw;D xm;Ny;D oufqikd &f m Properties rsm;udk
jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udk a&;om;
&rnf/

yHk(472)

28/ Lable1 Properties twGuf-


(u) (Name) - Label1
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - How many number?
29/ Lable2 Properties twGuf-
(u) (Name) - Label2
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - Enter each number = >
447 Microsoft Visual Basic 6.0

30/ Text1 Text Box Properties twGuf-


(u) (Name) - Text1
( c) Alignment - 0 - Left Justified
( *) Index - Empty
(C) Locked - False
( i) Text - Empty

31/ Text2 Text Box Properties twGuf-


(u) (Name) - Text
( c) Alignment - 0 - Left Justified
( *) Index - 1
(C) Locked - False
( i) Text - Empty

32/ Command1 Command Button Properties twGuf-


(u) (Name) - Command1
( c) Caption - &Add (Text Box)
( *) Enabled - True
33/ Command2 Command Button Properties twGuf-
(u) (Name) - Command2
( c) Caption - &Counting Sort
( *) Enabled - True
34/ Command3 Command Button Properties twGuf-
(u) (Name) - Command3
( c) Caption - E&xit
( *) Enabled - True
35/ Form1 Form Properties twGuf-
(u) (Name) - Form1
( c) Enabled - True
( *) Caption - Counting Sort (Ascending Order)
36/ Object: General, Proc: [Declaration] twGuf Dim num1, n, k(50),
f(50), kount(50) As Integer [ky½dk*&rfa&;om;&efjzpfygonf/
uGefysLwmvufpJG 448

37/ Add (Text Box) - Command1 Button twGuf-


Private Sub Command1_Click()
n = Val(Text1)
Text1.Locked = True
If num1 = 0 Then num1 = 1
If num1 > n Then Exit Sub
num1 = num1 + 1
Load Text(num1)
b1 = Text(num1).Name 'Text(num1).Name="Text"
b2 = Text(num1).Index 'Text(num1).Index = num1+1
Text(num1).Locked = True
Text(num1).Top = Text(num1 - 1).Top + 400
Text(num1).Left = Text(num1).Left - 400
Text(num1).Visible = True
Print Text(num1), Text(num1).Name, Text(num1).Index
i = Text(num1).Index - 1
k(i) = Text(num1)
Print k(i), i
Text(num1) = Text(num1)
End Sub

38/ Counting Sort - Command2 Button twGuf-


Private Sub Command2_Click()
Cls
For i = 1 To n
kount(i) = 1
Next
For i = 2 To n
For j = 1 To i - 1
If k(i) > k(j) Then
kount(i) = kount(i) + 1
Else
kount(j) = kount(j) + 1
End If
Next j
Next i
449 Microsoft Visual Basic 6.0

For i = 1 To n
f(kount(i)) = k(i)
Next
For x = 1 To n
Print f(x)
Next
End Sub

39/ Exit - Command3 Button twGuf-


Private Sub Command3_Click()
Unload Me
End
End Sub

40/ txufyg y½dk*&rfudk Run ygu yHk(473)ygtwdkif;jrifawGU&rnfjzpfygonf/

yHk(473)

---------------0-0-0---------------
uGefysLwmvufpJG 450

Insertion Sort udk Visual Basic jzifha&;om;jcif;


41/ atmufygtwdkif; Form wpfckudkwnfaqmuf&rnf/ yHk(474)/ 4if;wGif La-
bel, Text Box, Command Button wdjYk zifz
h efw;D xm;Ny;D oufqikd &f m Properties rsm;udk
jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udka&;om;
&rnf/

yHk(474)

42/ Lable1 Properties twGuf-


(u) (Name) - Label1
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - How many number?
43/ Lable2 Properties twGuf-
(u) (Name) - Label2
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - Enter each number = >
451 Microsoft Visual Basic 6.0

44/ Text1 Text Box Properties twGuf-


(u) (Name) - Text1
( c) Alignment - 0 - Left Justified
( *) Index - Empty
(C) Locked - False
( i) Text - Empty

45/ Text2 Text Box Properties twGuf-


(u) (Name) - Text
( c) Alignment - 0 - Left Justified
( *) Index - 1
(C) Locked - False
( i) Text - Empty

46/ Command1 Command Button Properties twGuf-


(u) (Name) - Command1
( c) Caption - &Add (Text Box)
( *) Enabled- True
47/ Command2 Command Button Properties twGuf-
(u) (Name) - Command2
( c) Caption - &Insertion Sort
( *) Enabled- True
48/ Command3 Command Button Properties twGuf-
(u) (Name) - Command3
( c) Caption - E&xit
( *) Enabled- True
49/ Form1 Form Properties twGuf-
(u) (Name) - Form1
( c) Enabled- True
( *) Caption - Counting Sort (Ascending Order)
50/ Object: General, Proc: [Declaration] twGuf Dim num1, n, k(50)
As Integer [ky½dk*&rfa&;om;&efjzpfygonf/
uGefysLwmvufpJG 452

51/ Add (Text Box) - Command1 Button twGuf-


Private Sub Command1_Click()
n = Val(Text1)
Text1.Locked = True
If num1 = 0 Then num1 = 1
If num1 > n Then Exit Sub
num1 = num1 + 1
Load Text(num1)
b1 = Text(num1).Name 'Text(num1).Name="Text"
b2 = Text(num1).Index 'Text(num1).Index = num1+1
Text(num1).Locked = True
Text(num1).Top = Text(num1 - 1).Top + 400
Text(num1).Left = Text(num1).Left - 400
Text(num1).Visible = True
Print Text(num1), Text(num1).Name, Text(num1).Index
i = Text(num1).Index - 1
k(i) = Text(num1)
Print k(i), i
Text(num1) = Text(num1)
End Sub

52/ Insertion Sort - Command2 Button twGuf-


Private Sub Command2_Click()
Cls
For i = 2 To n
current = k(i)
j=i-1
70 If j < 1 Or current >= k(j) Then GoTo 100
k(j + 1) = k(j)
j=j-1
GoTo 70
100 k(j + 1) = current
Next i
Do While j >= 1 And current < k(j)
k(j + 1) = k(j)
j=j-1
Loop
453 Microsoft Visual Basic 6.0

For x = 1 To n
Print k(x)
Next
End Sub

53/ Exit - Command3 Button twGuf-


Private Sub Command3_Click()
Unload Me
End
End Sub

54/ txufyg y½dk*&rfudk Run ygu yHk(475)ygtwdkif;jrifawGU&rnfjzpfygonf/

yHk(475)

---------------0-0-0---------------
uGefysLwmvufpJG 454

Selection Sort with Exchange udk Visual Basic jzifha&;om;jcif;


55/ atmufygtwdkif; Form wpfckudkwnfaqmuf&rnf/ yHk(476)/ 4if;wGif La-
bel, Text Box, Command Button wdjYk zifz
h efw;D xm;Ny;D oufqikd &f m Properties rsm;udk
jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udka&;om;
&rnf/

yHk(476)

56/ Lable1 Properties twGuf-


(u) (Name) - Label1
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - How many number?
57/ Lable2 Properties twGuf-
(u) (Name) - Label2
( c) AutoSize - True
( *) BackStype - 0 - Transparent
(C) Caption - Enter each number = >
455 Microsoft Visual Basic 6.0

58/ Text1 Text Box Properties twGuf-


(u) (Name) - Text1
( c) Alignment - 0 - Left Justified
( *) Index - Empty
(C) Locked - False
( i) Text - Empty

59/ Text2 Text Box Properties twGuf-


(u) (Name) - Text
( c) Alignment - 0 - Left Justified
( *) Index - 1
(C) Locked - False
( i) Text - Empty

60/ Command1 Command Button Properties twGuf-


(u) (Name) - Command1
( c) Caption - &Add (Text Box)
( *) Enabled - True
61/ Command2 Command Button Properties twGuf-
(u) (Name) - Command2
( c) Caption - &Selection Sort with Exchange
( *) Enabled - True
62/ Command3 Command Button Properties twGuf-
(u) (Name) - Command3
( c) Caption - E&xit
( *) Enabled - True
63/ Form1 Form Properties twGuf-
(u) (Name) - Form1
( c) Enabled - True
( *) Caption - Selection Sort with Exchange
(Ascending Order)

64/ Object: General, Proc: [Declaration] twGuf Dim num1, n, k(50)


As Integer [ky½dk*&rfa&;om;&efjzpfygonf/
uGefysLwmvufpJG 456

65/ Add (Text Box) - Command1 Button twGuf-


Private Sub Command1_Click()
n = Val(Text1)
Text1.Locked = True
If num1 = 0 Then num1 = 1
If num1 > n Then Exit Sub
num1 = num1 + 1
Load Text(num1)
b1 = Text(num1).Name 'Text(num1).Name="Text"
b2 = Text(num1).Index 'Text(num1).Index = num1+1
Text(num1).Locked = True
Text(num1).Top = Text(num1 - 1).Top + 400
Text(num1).Left = Text(num1).Left - 400
Text(num1).Visible = True
Print Text(num1), Text(num1).Name, Text(num1).Index
i = Text(num1).Index - 1
k(i) = Text(num1)
Print k(i), i
Text(num1) = Text(num1)
End Sub

66/ Selection Sort with Exchange - Command2 Button twGuf-


Private Sub Command2_Click()
Cls
For i = 1 To n - 1
mini = k(i): idx = i
For j = i + 1 To n
If k(j) >= mini Then GoTo 10
mini = k(j): idx = j
10 Next j
k(idx) = k(i): k(i) = mini
Next i
For i = 1 To n
Print k(i)
Next
457 Microsoft Visual Basic 6.0

For i = 1 To n
Print k(i)
Next
End Sub

67/ Exit - Command3 Button twGuf-


Private Sub Command3_Click()
Unload Me
End
End Sub

68/ txufyg y½dk*&rfudk Run ygu yHk(477)ygtwdkif;jrifawGU&rnfjzpfygonf/

yHk(477)

---------------0-0-0---------------

You might also like