Date post: | 15-Nov-2014 |
Category: |
Documents |
Upload: | nyiphonehlat |
View: | 432 times |
Download: | 17 times |
1 Microsoft Visual Basic 6.0
Chapter (1)
Introduction pum;csD;1/ Microsoft Visual Basic 6.0 onf Programming rsm;a&;om;&mwGif toHk;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"dyÜg,f&ygonf/
Visual Basic 6.0 pwifzGifhjcif;2/ Windows 95 ESifh txufuGefysLwmpufwpfvHk;zGifhvdkufaomtcg Task Bar
ay:wGif Start udk Mouse jzifh Left Click ESdyf&rnf/ xdkYaemuf Program tm;a½G;cs,fyg/Sub-Menu wpfckxyfrHay:vmrnf/ xdk Sub-Menu xJrS Microsoft Visual Basic
6.0 tm;a½G;ygu Visual Basic 6.0 tm;pwiftoHk;jyK&eftqifoifhjzpfaernf/ Desktop
nmzuftay:axmifhwGif Microsoft Office Short Cut Bar ½Sdaeygu 4if; Bar wef;xJwGif Microsoft Visual Basic 6.0 Smart Icon jyyguvnf; Left Click ESdyfjcif;jzifhvnf;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:,ltoHk;jyKEdkifayonf/
3/ aemufwpfenf;rSm Start → → Run udk Mouse Left Click vkyfvdkufyguyHk(1)ygtwdkif; Run Dialog Box ay:vmrnf/
yHk(1)
uGefysLwmvufpJG 2
4/ Open nmzuf½Sd List Box xJwGif Cursor 0ifaevdrfhrnf/ xdktcg Browse
udka½G;yg/ VB6.EXE File ½Sd&mtqifhqifhodkY0ifNyD; OK udkESdyfygu Visual Basic 6.0
yGifhvmrnf/ yHk(2)/
Creating an Application y½dk*&rfwpfckudkpwiftajcwnfjcif;5/ yxrOD;pGm Visual Basic Programming jzifh zm&if[dkufrS pifwD*&dwfodkYajymif;vJaomy½dk*&rfykpämukda&;om;&mwGif zm&if[dkufrS pifwD*&dwfodkYajymif;vJaomFormula udkod½Sd&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/
yHk(2)
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 udka½G;yg/ Pulldown Menu (or) Dropdown Menu wpfckay:vmrnf/4if;xJrS New Project udka½G;&rnf/ yHk(3)/
8/ xdktcg New Project Dialog Box wpfckay:vmNyD; yHkrSeftm;jzifh Stan-
dard EXE Smart Icon a½G;cs,fjcif;cHae&ygu OK udka½G;cs,f&ygrnf/ ykH(4)/
yHk(3)
uGefysLwmvufpJG 4
9/ zm&if[dkufrS pifwD*&dwfodkYajymif;vJrnfh y½dk*&rfa&;om;&ef Form1 qdkonfhForm yHkpHwpfckay:vmrnf/ yHk(5)/
yHk(4)
yHk(5)
5 Microsoft Visual Basic 6.0
10/ 4if; Form yHkpHwGif Text, Memory Variable rsm;zefwD;&eftwGuf Visual
Basic wGiftqifoifhyg½Sdaeaom Toolbox udkac:,l&rnfjzpfygonf/ Toolbox udkrawGUygu Menu Bar ½Sd View rSwqifha½G;yg/ yHk(6)/ xdktcg Toolbox ay:vmayrnf/yHk(7)/
11/ Icon udktoHk;jyKí Fahrenheit Degree, Centigrade Degree
rsm;udk Form xJwGifa&;om;&rnf/ yHk(8)/
yHk(6)yHk(7)
yHk(8)
uGefysLwmvufpJG 6
12/ þuJhodkY Fahrenheit Degree, Centigrade Degree rsm;udk zefwD;&mwGifForm1 xJodkY Label Icon udka½G;í Drag and Drop vkyfyg&ef/ xdktcg Form1 xJwGifyHk(9)ygyHkpHtwdkif;jzpfaernf/
Set Properties *kPfowÅdrsm;udkjyifqifjcif;13/ Label [kazmfjyonfh Text Frame udkjrifawGU&rnfjzpfNyD; 4if; Text Frame
ay:rS Mouse Right Click udkESdyfygu Short Cut Menu wpfckay:vmrnf/ yHk(10)/
yHk(9)
yHk(10)
7 Microsoft Visual Basic 6.0
14/ 4if; Short Cut Menu \atmufqHk;jzpfaom Properties udka½G;yg/ xdktcgLabel1 ESifhoufqdkifaom Properties udkyHk(11)ygtwdkif;jrifawGU&rnf/
15/ yHk(11)yg Properties - Label1 xJ½Sd Label1 Label wGifyg0ifaomtcsufrsm;udk atmufygtwdkif;jyifqif&rnf -
(u) AutoSize - True
( c) BackStyle - 0 - Transparant
( *) Caption - Fahrenheit Degree = = = >
(C) Font - Font Size - 12, Font Style - Bold [kjyifqifjznfhpGufNyD; 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 xyfrHESdyfyg&ef/ xdktcg Short Cut Menu wpfckxyfrHay:vmrnf/ yHk(12)/
yHk(11)
uGefysLwmvufpJG 8
17/ 4if;rS Short Cut Menu \atmufqHk;jzpfaom Properties udka½G;cs,f&rnf/xdktcg Properties - Text1 Text1 TextBox ay:vmrnf/ 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 vkyfyg/ xdktcg Text1 TextBox Proper-
ties ydwfoGm;vdrfhrnf/ xdkenf;wl Text2 udkvnf; Text1 enf;wl
yHk(12)
yHk(13)
9 Microsoft Visual Basic 6.0
zefwD;xm;&rnf/ yHk(14)/ Text1 rSm zm&if[dkuf'D*&DtwGufjzpfíText2 rSm pifwD*&dwf'D*&DtwGufjzpfygonf/
Write Code y½dk*&rfa&;jcif;19/ Fahrenheit Degree ½dkufoGif;&efjzpfaom Text Box ü*Pef;wpfck½dkufNyD;<Enter> udkESdyfyg/ Centigrade Degree udkoufqdkif&m Text Box üazmfjyrnfjzpfonf/Centigrade Degree ½dkufoGif;&efjzpfaom Text Box ü*Pef;wpfck½dkufNyD;<Enter>udkESdyfygu Fahrenheit Degree udkoufqdkif&m Text Box ütjyeftvSefazmfjyrnfjzpfonf/þ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 ESdyf&rnf/ xdktcg Program a&;om;&eftqifoifhtajctaeay;vmrnf/ yHk(15)/
yHk(14)
yHk(15)
uGefysLwmvufpJG 10
20/ Text1 Text Box udk Double Click ESdyfí Private Sub Text1_Change()
ESifh 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)/
21/ xdkenf;wl Text2 Text Box udk 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)/
22/ 4if;zdkifudk odrf;vdkygu Menu Bar ½Sd File udka½G;NyD; Pulldown Menu wGifyg0ifaom 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 vkyf&rnf/ yHk(19)/
yHk(16)
yHk(17)
11 Microsoft Visual Basic 6.0
23/ xdktcg Save Project As Dialog Box ay:vmNyD; File Name List Box
wGif extest1 [ka&;NyD; Mouse Left Click vkyf&rnf/ yHk(20)/ yxrodrf;aomzdkifrSmForm File, Extension rSm .frm jzpfNyD; 'kwd,trnfjzifhodrf;aomzdkifrSm Visual Ba-
sic Project File, Extension rSm .Vbp jzpfygonf/
yHk(18)
yHk(19)
uGefysLwmvufpJG 12
24/ xdktcg Project - Project Dialog Box wGif Project1(extest001.vbp)
ESifh Form1 (extest001.frm) [líyHk(21)ygtwdkif;jzpfay:vmayrnf/
25/ udk Click vkyfygu extest001 yHkpHay:vmrnfjzpfNyD; 4if;Form udkydwfvdkufygu Close Button udka½G;&rnf/ yHk(22)/ udk Click
vkyfygu Program a&;om;xm;onfrsm;udkawGU½Sd&rnf/ yHk(23)/
yHk(20)
yHk(21)
13 Microsoft Visual Basic 6.0
26/ txufyg Project File jzpfaom extest001 udk Run vdkygu Menu Bar ½SdRun udka½G;yg/ xdkYaemuf Start udka½G;yg/ yHk(24)?(odkYr[kwf) Short Cut Key (or) Short
Hand Key taejzifh Function Key jzpfaom F5 udkESdyfívnf;&Edkifayonf/ (odkYr[kwf)Menu Bar atmuf½Sd Standard Toolbar rS Icon udk Left Click ESdyfjcif;jzifhvnf;&Edkifayonf/ xdktcgyHk(25)ygtwdkif; Text Box xJwGif Cursor tqifoifha&muf½Sdaernf/
yHk(22)
yHk(23)
yHk(24)
uGefysLwmvufpJG 14
27/ zm&if[dkuf'D*&DudkxnfhNyD; <Enter> ESdyfygu pifwD*&dwf'D*&DtajzwGufay;rnf/ pifwD*&dwf'D*&DudkxnfhNyD; <Enter> ESdyfyguvnf; zm&if[dkuf'D*&DudkwGufay;rnf/rdrdBuKdufESpfouf&m Text Box udk*Pef;½dkufxnfhNyD; <Enter> ESdyfEdkifonfhtcGifhta&;½Sdonf/ 4if; Form tm;ydwfvdkufygu Form1 \nmzuftay:axmifhwGif½Sdaom Close
Button udka½G;&rnf/
28/ Visual Basic 6.0 xJrSxGufvdkygu Menu Bar ½Sd File udka½G;NyD; Pulldown
Menu \atmufqHk;jzpfaom Exit udka½G;&ygrnf/ xdktcg 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;ygurodrf;bJxGufoGm;ayrnf/ Cancel udka½G;ygu Microsoft Visual Basic 6.0 rSrxGufbJ,ciftwdkif;tvkyfvkyfEdkifrnfjzpfygonf/ yHk(26)/
yHk(25)
yHk(26)
15 Microsoft Visual Basic 6.0
29/ ½SdNyD;om; extest001 File udkzGifhvdkygu Menu Bar ½Sd File udka½G;yg/ xdktcgPulldown Menu ay:vmrnf/ 4if;rS udka½G;yg/ xdktcg Open
Project Dialog Box ay:vmNyD;4if;rS extest001.vbp udka½G;í Open udk Click ESdyf&efjzpfonf/ yHk(27)/
30/ odkYr[kwf extest001 File udkzGifhvdkygu Menu Bar ½Sd File udka½G;yg/ Exit
tay:½Sd Recent File xJwGif extest001.vbp udka½G;yguvnf; yGifhvmrnfjzpfonf/yHk(28)/
yHk(27)
uGefysLwmvufpJG 16
31/ þuJhodkY zdkifzGifhvdkufaomtcg wcgw&H Project File rawGU½Sdygu Menu
Bar ½Sd View udka½G;yg/ 4if;rS Pulldown Menu wpfckjzpfaom Project Explorer udka½G;yg/ odkYr[kwf Short Cut Key jzpfonfh Ctrl+R udkESdyfyg/ yHk(29)/
yHk(28)
17 Microsoft Visual Basic 6.0
32/ xdktcg yHk(30)wGifazmfjyxm;onfhtwdkif; extest001 Dialog Box ay:vmayrnf/ , wdkYudk toHk;jyKí Project File udkjyefvnfjyKjyifodrf;Edkifayonf/
yHk(29)
yHk(30)
uGefysLwmvufpJG 18
Factorial ½Smonfh y½dk*&rfa&;jcif;33/ atmufygyHk(31)ygtwdkif; Visual Basic wGifzefwD;xm;&rnf/
34/ Title Bar wGif ½kyfyHkESifhwuG Factorial pmom;xnfhoGif;&mwGif Properties
ü Form1 Form udka½G;yg/ xdkYaemufatmufygwdkYudkjyifqif&ef/ yHk(32)/
yHk(31)
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 xJrSoifhawmf&m½kyfyHkudka½G;xnfhjcif;jzpfonf/
36/ Run ESifh Exit onf Command Button rsm;jzpfMuNyD; 4if;wdkY\oufqdkif&mProperties 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
( c) Font - MS Sans Serif, Font Style→→Bold, Font Size→→10
38/ Exit Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command2_Click()
Unload MeEnd
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
Clsa = Text1kount = 1: k = 1Do While k < a + 1
kount = kount * kk = k +1
loopprint "Requirement Answer = = = > ", kountText2 = 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 xyfcgtvkyfvkyf&rnfhudpörsm;wGif txufyg Do ... Loop a&;xHk;udktoHk;jyKonf/ xdktcg Text1 Text Box xJwGif Cursor 0ifaernfjzpfNyD; 4if;wGif*Pef;wpfckck ½dkufxnfh&rnf/ Oyrm-4 [k½dkufNyD; Run Command Button udk Click vkyfyguPrivate Sub Command1_Click() ESifh End Sub Mum;½Sd Command rsm;udkwpfaMumif;csif;tvkyfvkyfoGm;rnf/ Cls a&;xHk;rSm Form ay:wGiftjcm;udpörsm;a&;xm;ygu ½Sif;vif;ypf&efjzpfygonf/ a = Text1 rSm a xJwGif 4 a&muf½Sdvmrnf/ kount = 1 rSm kount xJwGif 1 a&muf½Sdvmrnf/ k = 1 rSm k xJwGif 1 udkxnfhxm;rnf/ Do While k<a+1 rSm,cktcsdefwGif k \wefzdk;rSm 1 jzpfaernf/ a \wefzdk;rSm 4 jzpfaeNyD; 1 jzifhaygif;ygu5 jzpfrnf/ 1 onf 5 xufi,faeojzifh qufvkyf&efjzpfonf/ xdkYaMumifh k wefzdk;onf5 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 jzpfaom 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 xJwGif 2 a&muf½SdoGm;rnf/ atmufwpfaMumif;jzpfaom Loop odkYqufrqif;bJ Do While
k<a+1 odkYjyefwufNyD; Condition udkpdppfrnf/ k \wefzdk;rSm ,cktcg 2 jzpfaernf/ 2
21 Microsoft Visual Basic 6.0
onf 5 xufi,faeojzifhatmufwpfaMumif;jzpfaom kount = kount * k odkY qif;vmrnf/ kount \wefzdk;onf 1 jzpfNyD; k wefzdk;rSm 2 jzpfaomaMumifh 2 ESifh 1 ajr§mufygu2 &rnf/ 4if;wefzdk; kount xJa&mufoGm;rnf/ atmufwpfaMumif;qif;ygu k = k +1
jzpfoGm;ayrnf/ xHk;pHtwdkif; Do While k<a+1 odkYjyefwufNyD; Condition udkpdppfayrnf/k \wefzdk;rSm ,cktcg 3 jzpfaernf/ 3 onf 5 xufi,faeojzifh atmufwpfaMumif;jzpfaom kount = kount * k odkYqif;vmrnf/ kount \wefzdk;onf 2 jzpfNyD; k \wefzdk;rSm3 jzpfvmaomaMumifh 2 ESifh 3 ajr§mufygu 6 &rnf/ 4if;wefzdk; tm; kount xJa&mufoGm;rnf/ atmufwpfaMumif;qufqif;ygu k = k + 1 udk awGUrnf/ k \wefzdk;rSm 3 jzpfí3 ESifh 1 udkaygif;ygu 4 &rnf/ k \wefzdk;rSm 4 jzpfoGm;ayrnf/ xHk;pHtwdkif; Do
While k<a+1 odkYjyefwufNyD; Condition udkpdppfrnf/ k \wefzdk;rSm ,cktcg 4 jzpfaernf/ 4 onf 5 xufi,faeojzifh atmufwpfaMumif;jzpfaMumif; kount = kount * k
odkYqif;vmrnf/ kount \wefzdk;onf 6 jzpfNyD; k \wefzdk;rSm 4 jzpfaomaMumifh 6 ESifh4 ajr§mufygu 24 &rnf/ 4if;wefzdk; kount xJa&mufoGm;rnf/ atmufwpfaMumif;qufqif;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 udkpdppfrnf/ k \wefzdk;rSm ,cktcg 5 jzpfaernf/ 5 onf 5 xufi,faeojzifhCondition rSm;oGm;ayrnf/ xdktcg Do While ... Loop \ atmufwpfaMumif;jzpfaomPrint "Requirement Answer = = = > ", kount odkY qif;vmayrnf/ Form \b,fbufaxmifhwGif "Requirement Answer = = = > pmom;ay:vmNyD; 24 [kazmfjyrnf/ Text2 xJwGifvnf; tajzjzpfaom 24 udkazmfjyaernfjzpfonf/
42/ 2 jzifhpm;u 1 <uif;rnf/ 3 jzifhpm;ygu 2 <uif;rnf/ 5 jzifhpm;ygu 4 <uif;rnf/ 7 jzifhpm;ygu 6 <uif;rnf/ 4if;udef;wefzdk;udk½Sm&ef/ 4if;ykpämudkwGufcsuf&ef atmufazmfjyyg yHk(33)ygtwdkif; Visual Basic wGifzefwD;xm;yg&ef/
yHk(33)
uGefysLwmvufpJG 22
43/ Exit Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command2_Click()
Unload MeEnd
End Sub
44/ Run Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command1_Click()
a = 1: Check = TrueDo ' While Check = True
If a Mod 2 = 1 And a Mod 3 = 2 And a Mod 5 = 4And a Mod 7 = 6 ThenExit Do ' Exit Inner Loop
Elsea = a + 1
End IfLoop Until Check = False 'Exit Outer Loop ImmediatelyPrint "Requirement Answer = > ", aText1 = 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 number2A = 7 Mod 4, A →→ 3A = 7 Mod 3, A →→ 1
23 Microsoft Visual Basic 6.0
Prime Number udk½Smjcif;46/ atmufygyHk(34)ygtwdkif; Visual Basic wGifzefwD;xm;&rnf -
47/ Exit Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command2_Click()
Unload MeEnd
End Sub
48/ Run Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command1_Click()
'To determine whether the given number is Prime NumberClsmp = Text1mc = 2Do While Not (mp Mod mc = 0 And mc <= mp)
mc = mc + 1LoopPrint: PrintPrint "MP ", mpPrint "MC ", mcIf Text1 = mc Then
PrintPrint mp, " is a Prime Number."
ElsePrintPrint mp, " does not Prime Number."
End IfEnd Sub
yHk(34)
uGefysLwmvufpJG 24
49/ tu,fírdrdpdwfBuKduf*Pef;udk½dkufoGif;NyD; 2 ESifh rdrd½dkufoGif;onfh *Pef;Mum;Prime Number ta&twGufudk½Smvdkygu yHk(35)ygtwdkif; zefwD;wnfaqmuf&ef -
50/ Exit Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command2_Click()
Unload MeEnd
End Sub
51/ Run Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command1_Click()
Clsd = 1pp = 2zz = Val(Text1)Do While pp < zz
mc = 2Do While Not (pp Mod mc = 0 And mc <= pp)
mc = mc + 1LoopIf mc = pp Then
d = d + 1Print mc;
End Ifpp = pp + 1
LoopText2 = d - 1
End Sub- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(35)
25 Microsoft Visual Basic 6.0
Chapter (2)
Menu wnfaqmufjcif;1/ Menu wnfaqmuf&mwGif Menu Bar rS Tools Menu udka½G;yg/ xdkYaemufPulldown Menu xJrS Menu Editor ... udka½G;yg/ yHk(36)/ xdktcg Menu Editor
Dialog Box wpfckay:vmrnf/ yHk(37)/
2/ Caption nmzuf½Sd Box wGif &Options [ka&;&ef/ Name nmzuf½Sd Box
wGif Options [ktrnfowfrSwf&ef/ xdktcg atmufzuf½Sd List Box wGif yHk(38)ygtwdkif;jzpfay:vmrnf/
yHk(36)
yHk(37)
uGefysLwmvufpJG 26
3/ txufygyHk(38)wGif OK udk Mouse Left Click vkyfygu yHk(39)ygtwdkif;jzpfay:vmrnf/ 4if;onf Menu Bar jzpfonf/
yHk(38)
yHk(39)
27 Microsoft Visual Basic 6.0
4/ xdkYaemuf Pulldown Menu rsm;udkqufvufzefwD;&rnf/ Menu Bar rSTools Menu udkjyefa½G;yg/ xdkYaemuf Pulldown Menu xJrS Menu Editor ... udka½G;yg/xdktcg Menu Editor Dialog Box jyefvnfay:vmrnf/ Command Button wpfckjzpfaom udka½G;yg/ xdkYaemuf Caption List Box ü &Test Buttons udkjznfhpGufyg/ Name List Box ü TestButtons udkjznfhpGufNyD; udka½G;yg/ TestButtons udkuyfía&;&rnf/ Test ESifh Buttons udkcGgíra&;&yg/ yHk(40) wGifazmfjyxm;onfhtwdkif;jzpfvmygu OK udk Click vkyfyg/
5/ xdktcg yHk(41)wGifazmfjyxm;ouJhodkY Test Buttons onf Pulldown Menu
(or) Dropdown Menu wpfckjzpfvmrnf/
yHk(40)
uGefysLwmvufpJG 28
6/ txufygenf;twdkif; Caption List Box wGif &Word Warp and
Autosize, &Check Box, &Number System, &List Box wdkYESifh Name List Box
wGif WordWrapandAutosize, CheckBox, NumberSystem, ListBox wdkYudkjznfhpGufNyD; OK udk Left Click vkyfygu yHk(42)wGifjrif&onfhtwdkif; Pulldown Menu (or)
Dropdown Menu rsm;toD;oD;jzpfvmrnf/
yHk(41)
yHk(42)
29 Microsoft Visual Basic 6.0
7/ Pulldown Menu wpfckjzpfaom List Box udk Mouse Left Click ESdyfyguaemufxyf Sub-Menu wpfckay:xGufapvdkygu Menu Editor ... udkjyefac:í
udka½G;yg/ xdkYaemuf udka½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/
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 udka½G;yg/ Dropdown Menu wpfckjzpfaom Menu Editor ... udkjyefvnfa½G;yg/...&Check Box udka½G;í Dropdown Arrow jzifhatmufqHk;udk a&mufatmifa½TU&ef/xdkenf;wl ...&Number System udkvnf; atmufqHk;odkYa&mufatmifa½TUNyD; OK udkClick vkyfjcif;jzifh &½SdEdkifayonf/ yHk(44)? xdktcg yHk(45)ygtwdkif; Menu ajymif;vJoGm;ayrnf/
yHk(43)
uGefysLwmvufpJG 30
9/ Form1 Menu xJrSxGuf&ef Command Button jzifh Exit udkzefwD;í xHk;pHtwdkif; y½dk*&rfa&;om;&rnf/ yHk(46)/Private Sub Command1_Click()
Unload MeEnd
End Sub
yHk(44)
yHk(45)
31 Microsoft Visual Basic 6.0
Pulldown Menu wpfckjzpfaom Test Buttons udka½G;ygujzpfvmrnfh Program udka&;om;jcif;10/ Pulldown Menu wpfckjzpfaom Test Buttons udka½G;ygu 4if;ESifhvdkufavsmnDaxGjzpfap&ef Form wpfck Insert jyKvkyfí vdktyfaomy½dk*&rfrsm;a&;om;&rnf/ Form
wpfckudk Insert jyKvkyfvdkygu Menu Bar ½Sd Project udka½G;yg/ xdkYaemuf Pulldown
Menu jzpfaom Add Form udk a½G;&efjzpfonf/ yHk(47)/
yHk(46)
yHk(47)
uGefysLwmvufpJG 32
11/ Form2 jzpfay:vmygu yHk(48)ygtwdkif;wnfaqmuf&efjzpfonf/
12/ Command Button wpfckjzpfaom ChangeSignal wGif atmufygy½dk*&rfudka&;om;&rnf-Private Sub Command1_Click()
ChangeSignalEnd Sub
13/ Command Button aemufwpfckjzpfaom Close wGif atmufygy½dk*&rfudka&;om;&rnf-Private Sub Command2_Click()
Form2.HideForm1.Show
End Sub
14/ Command1 wGifa&;om;xm;aomy½dk*&rfrSm wdkuf½dkuf Run aomy½dk*&rfjzpfojzifh 4if;y½dk*&rfudk qufvufa&;om;&ef vdktyfygonf/ yHk(49)/
15/ Pulldown Menu wpfckjzpfaom Test Button udk Click vkyfyg/ 4if;wGifForm2 udk vSrf;íac:aom y½dk*&rfudka&;om;&rnf/Private Sub TestButtons_Click()
Form2.ShowEnd Sub
yHk(48)
33 Microsoft Visual Basic 6.0
16/ Form2 \ General wGifatmufygy½dk*&rfudk xyfrHa&;om;&rnf -
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;í vdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(50)/
18/ Form3 udkatmufygtwdkif;wnfaqmuf&rnf? yHk(51)/
yHk(49)
yHk(50)
yHk(51)
uGefysLwmvufpJG 34
19/ yHk(51)yg Form wGif , ESifh wdkY
udkoHk;xm;ygonf/ Check1 wGif Auto Size ESifh Check2 wGif Word Wrap wdkYudkowfrSwfxm;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 IfEnd 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 IfEnd Sub
Private Sub Command1_Click() Form3.Hide Form1.ShowEnd Sub
List Box (Pulldown Menu) twGuf Program a&;om;jcif;20/ List Box udka½G;vdkufygu Sub-Menu wpfckxyfrHay:vmrnf/ 4if;wdkYrSmNumber, Text wdkYjzpfMuonf/ Number udka½G;ygu Number ESifhywfoufaom Form
wpfckay:&efESifh vdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(52)/
35 Microsoft Visual Basic 6.0
21/ tqdkyg Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf atmufygtwdkif;jyifqif&rnf/
22/ txufygyHk(53)udkzefwD;&mwGif , , ESifh
wdkYudkoHk;xm;ygonf/ txufyg Form yHkpHtm; 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.TextText1.Text = ""Text1.SetFocus
yHk(53)
yHk(52)
uGefysLwmvufpJG 36
Label3.Caption=List1.ListCountEnd Sub
24/ Remove Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command2_Click()
Dim Ind As IntegerInd = List1.ListIndexIf Ind >= 0 Then
List1.RemoveItem IndLabel3.Caption = List1.ListCount
ElseBeep
End IfCommand2.Enabled = (List1.ListIndex <> -1)
End Sub
25/ Clear Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command3_Click()
List1.ClearCommand2.Enabled = FalseLabel3.Caption = List1.ListCount
End Sub
26/ Close Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command4_Click()
Unload MeEnd 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 = TrueEnd Sub
37 Microsoft Visual Basic 6.0
29/ Text1, Add Command Button wdkYtwGufatmufyg Program udka&;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 wpfckudkzefwD;ívdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(54)/
31/ tqdkyg Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf atmufygtwdkif;jyifqif&rnf/ yHk(55)/
32/ txufygyHk(55)udkzefwD;&mwGif , , ESifh
wdkYudkoHk;xm;ygonf/ txufyg Form yHkpHwGiftpDtpOfrsm;udk Run
Edkif&eftwGuf vdktyfaomy½dk*&rfrsm;udk a&;om;&rnf/
yHk(54)
yHk(55)
uGefysLwmvufpJG 38
33/ Add Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command1_Click()
List1.AddItem Text1.TextText1.Text = ""Text1.SetFocusLabel3.Caption=List1.ListCount
End Sub
34/ Remove Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command2_Click()
Dim Ind As IntegerInd = List1.ListIndexIf Ind >= 0 Then
List1.RemoveItem IndLabel3.Caption = List1.ListCount
ElseBeep
End IfCommand2.Enabled = (List1.ListIndex <> -1)
End Sub
35/ Clear Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command3_Click()
List1.ClearCommand2.Enabled = FalseLabel3.Caption = List1.ListCount
End Sub
36/ Close Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command4_Click()
Unload MeEnd Sub
37/ List Box (Single Click) twGufPrivate Sub List1_Click()
Command2.Enabled = (List1.ListIndex <> -1)End Sub
39 Microsoft Visual Basic 6.0
38/ List Box (Double Click) twGufPrivate Sub List1_DblClick()
Command2.Value = TrueEnd Sub
39/ Text1, Add Command Button wdkYtwGufPrivate Sub Text1_Change()
Command1.Enabled = (Len(Text1.Text)>0)End Sub
40/ Check Box (Pulldown Menu) twGuf Program a&;om;jcif;Pulldown Menu wpfckjzpfaom Check Box udka½G;ygu 4if;ESifhvdkufavsmnD
axGjzpfap&ef aemufxyf Form wpfckzefwD;í vdktyfaomy½dk*&rf rsm;a&;om;&rnf/yHk(56)/
41/ tqdkyg Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&ef twGuf wpfzufygtwdkif;
jyifqif&rnf/ yHk(57)/ , , ESifh
wdkYudkoHk;xm;ygonf/
yHk(56)
uGefysLwmvufpJG 40
42/ txufyg yHk(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 FontSet a1 = Text1.FontIf Check1.Value = 1 Then
a1.Bold = TrueElse
a1.Bold = FalseEnd If
End Sub
44/ Check2 wGifatmufyg Program udka&;om;&ef-Private Sub Check2_Click()
Dim a1 As FontSet a1 = Text1.FontIf Check2.Value = 1 Then
a1.Italic = True
yHk(57)
41 Microsoft Visual Basic 6.0
Elsea1.Italic = False
End IfEnd Sub
45/ Check3 wGifatmufyg Program udka&;om;&ef-Private Sub Check3_Click()
Dim a1 As FontSet a1 = Text1.FontIf Check3.Value = 1 Then
a1.Underline = TrueElse
a1.Underline = FalseEnd If
End Sub
46/ Check4 wGifatmufyg Program udka&;om;&ef-Private Sub Check4_Click()
Dim a1 As FontSet a1 = Text1.FontIf Check4.Value = 1 Then
a1.Strikethrough = TrueElse
a1.Strikethrough = FalseEnd If
End Sub
47/ Close Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command1_Click()
Unload MeEnd Sub
uGefysLwmvufpJG 42
Number System (Pulldown Menu) twGuf Program a&;om;jcif;48/ Pulldown Menu wpfckjzpfaom Number udka½G;ygu 4if;ESifhvdkufavsmnDaxGjzpfap&ef aemufxyf Form wpfckzefwD;í vdktyfaomy½dk*&rfrsm;a&;om;&rnf/yHk(58)/
49/ tqdkyg Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf atmufygtwdkif;jyifqif&rnf/ yHk(59)/
50/ txufyg , , ESifh
wdkYudkoHk;xm;ygonf/ 4if; Form yHkpHwGif Run í&Edkifap&ef vdktyfaomy½dk*&rfrsm;udka&;om;&rnf/
51/ General, Declarations wGifatmufyg Program udka&;om;&ef-Dim a As Integer
yHk(58)
yHk(59)
43 Microsoft Visual Basic 6.0
52/ Close Command Button wGifatmufyg Program udka&;om;&ef-Private Sub Command1_Click() Unload MeEnd 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 wdkYudkzefwD;&ef/ yHk(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;ygu4if;ESifhvdkufavsmnDaxGjzpfap&ef aemufxyf Form wpfckzefwD;í vdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(61)/
59/ tqdkyg Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf atmufygwdkif;jyifqif&rnf/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
yHk(61)
yHk(62)
45 Microsoft Visual Basic 6.0
62/ yHk(62)yg Form yHkpHtm; 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 IfNextCommand2.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 = FalseEnd Sub
65/ Close Command Button twGuf-Private Sub Command3_Click() Unload MeEnd 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) = TrueEnd 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 wpfckjzpfaom Scroll Bars udka½G;ygu 4if;ESifhvdkufavsmnDaxGjzpfap&ef Form wpfckzefwD;í vdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(63)/
69/ tqdkyg Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf yHk(64)ygtwdkif;
jyifqif&rnf/ , , ESifh wdkYudkoHk;
xm;ygonf/
yHk(63)
yHk(64)
47 Microsoft Visual Basic 6.0
70/ Function wpfckjzpfaom DoColor twGuf yHk(65)wGifazmfjyxm;ygonf/
71/ Close Command Button twGuf-Private Sub Command1_Click()
Unload MeEnd Sub
72/ Red Horizontal Scroll Bar twGuf-Private Sub HScroll1_Change()
HScroll1_Scroll 'Call the event procedure directly.End SubPrivate Sub HScroll1_Scroll()
DoColorEnd Sub
73/ Green Horizontal Scroll Bar twGuf-Private Sub HScroll2_Change()
HScroll2_Scroll 'Call the event procedure directly.End SubPrivate Sub HScroll2_Scroll()
DoColorEnd Sub
yHk(65)
uGefysLwmvufpJG 48
74/ Blue Horizontal Scroll Bar twGuf-Private Sub HScroll3_Change()
HScroll3_Scroll 'Call the event procedure directly.End SubPrivate Sub HScroll3_Scroll()
DoColorEnd Sub
Menu Bar aemufwpfckxyfrHjyKvkyfjcif;75/ yHk(66)ygyHkwGif Menu wpfckom½SdNyD; Menu rSxGufcGgvdkygu Command
Button wpfckudktoHk;jyKí xdk Command Button udk Click jyKvkyfjcif;jzifh xGufcGgEdkifayonf/ þuJhodkY Menu rSxGufcGgvdkonfh aemufxyf Menu Bar wpfckwnfaqmufvdkyguTools udka½G;yg/ xdkYaemuf Pulldown Menu wpfckjzpfaom Menu Editor ... udka½G;yg/
76/ xdktcg yHk(67)ygtwdkif; 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;&efjzpfonf/ yHk(67)? yHk(68)/
yHk(66)
49 Microsoft Visual Basic 6.0
yHk(67)
yHk(68)
uGefysLwmvufpJG 50
77/ xdktcg yHk(69)ygtwdkif; Menu rsm;ajymif;vJoGm;ayrnf/ Exit Command
Button tm;zsufypf&rnf/
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 MeEnd
End Sub- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
80/ txufyg y½dk*&rfrsm;udka&;&eftwGuf atmufyga&;xHk;rsm;udk od½Sd&efvdktyfygonf-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
yHk(69)
51 Microsoft Visual Basic 6.0
(Or)If <Condition> Then
[<Statements>]ElseIf <Conditon-n> Then
[<Statements>]] ...[Else
<Statements>]]End If
Oyrm -Number = 53 'Initialize VariableIf Number < 10 Then
Digits = 1ElseIf Number < 100 Then
'Condition evaluates to True so the next statement is executed.Digits = 2
ElseDigits = 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 IMsg = "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 otherNext 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 StrikethroughFont.Italic = Not Font.Italic 'Toggle italicFont.Underline = Not Font.Underline 'Toggle underlineFont.Size = 16 'Set size propertyIf 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 4MyOct = Oct(8) 'Returns 10MyOct = Oct(459) 'Returns 713
Syntax;Hex(<Number>)
53 Microsoft Visual Basic 6.0
Oyrm -MyHex = Hex(5) 'Returns 5MyHex = Oct(8) 'Returns AMyHex = Oct(459) 'Returns 1CBSyntax;
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 = 500End 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 ValueBlack 0 0 0Blue 0 0 255Green 0 255 0Cyan 0 255 255Red 255 0 0Magenta 255 0 255Yellow 255 255 0White 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 = TruePlayer(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 ICombo1.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) ThenList2.AddItem List1.List(I)
End IfNext I
End Sub
uGefysLwmvufpJG 56
Syntax;Load <Object>Unload <Object>
Oyrm -Private Sub Form_Click()
Dim Answer.Msg 'Declare VariableUnload Form1Msg = "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 IfEnd Sub
Syntax;<Object>.Hide<Object>.Show
Oyrm -Private Sub Form_Click()
Dim Answer.Msg 'Declare VariableHideMsg = "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 wGifzefwD;&ef/
2/ yHk(70)yg Form wGif(1)udk File List Box jzifhzefwD;xm;NyD;(2)
tm; Drive List Box jzifhzefwD;xm;ygonf/(3)udk Label
jzifhzefwD;xm;NyD;(4)tm; Dir List Box jzifhzefwD;xm;onf/(5)udk Com-
mand Button jzifhzefwD;xm;í(6)udk Image jzifhzefwD;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 [kjyifqifxm;&rnf/
5/ Image1 Image \ Properties wGif atmufygtwdkif;jyifqif&ef-(u) Border Style = Fixed Single
( c) Stretch = True/
yHk(70)
(1)
(2)
(3)
(4)
(5)
(6)
59 Microsoft Visual Basic 6.0
6/ Command1 Command Button \ Properties wGif Caption = E&xit
[kjyifqifxm;&rnf/
7/ tqdkyg Properties rsm;udk jyifqifjznfhpGufNyD;ygu oufqdkif&mtydkif;vdkufvdktyfaomy½dk*&rfrsm;a&;om;&efjzpfygonf/
8/ Command Button jzpfaom Exit twGuf -Private Sub Command1_Click() Unload Me EndEnd Sub
9/ Directory List Box twGuf -Private Sub Dir1_Change() File1.Path = Dir1.Path 'Update FilesEnd Sub
10/ Drive List Box twGuf -Private Sub Drive1_Change() Dir1.Path = Drive1.Drive 'Update Directory PathEnd Sub
11/ File List Box twGuf (Single Click)Private Sub File1_Click() Label1 = File1End 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.PathEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -14/ wpfzufygy½dk*&rfrsm;udka&;&eftwGuf atmufyga&;xHk;rsm;udk od½Sd&efvdktyfygonf-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]
OyrmPrivate 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
OyrmPrivate 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])
OyrmPrivate 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 IfMsg = "Choose OK to clear the bitmap from the form."MsgBox MsgPicture = LoadPicture() 'Clear form.
End Sub
Syntax;<Object>.Picture [=picture]
OyrmPrivate 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-
16/ yHk(71)yg Form wGif (1)udk jzifhzefwD;xm;NyD;(2)tm;
jzifh zefwD;xm;ygonf/ txufygtwdkif;jyifqifNyD;ygu oufqdkif&mtydkif;vdkuf y½dk*&rfrsm;a&;om;&efjzpfygonf/
17/ Form qJGwif&mwGiftvkyfvkyf&eftwGuf -Private Sub Form_Load()
Timer1.Interval = 1000 'Set Time IntervalEnd Sub
18/ Label1 wGiftcsdefjy&eftwGufPrivate Sub Timer1_Timer() Label1.Caption = Time 'Update Time DisplayEnd Sub
Syntax;<Object>.Interval [=milliseconds]
OyrmPrivate Sub Form_Load()
Timer1.Interval = 900 'Set interval.HScroll1.Min = 100 'Set minimum.HScroll1.Max = 900 'Set maximum.
End Sub
yHk(71)
(1)
(2)
63 Microsoft Visual Basic 6.0
Private Sub HScroll_Change()'Set interval according to scroll bar value.Timer1.Interval = 1000 - HScroll.Value
End SubPrivate 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 FunctionSyntax;
TimeOyrm
Mytime = Time 'Return Current System Time
Date FunctionSyntax;
DateOyrm
MyDate = #February 12, 1985# 'Assign a dateDate = MyDate 'Change System Date.
Syntax;Now ' Returns the current date and time according.
OyrmToday = Now 'Assign current system date and time
Day FunctionSyntax;
Day(date)Oyrm
MyDate = #February 12, 1969# 'Assign a dateMyDay = Day(MyDate) 'MyDay contains →→ 12
uGefysLwmvufpJG 64
Hour FunctionSyntax;
Hour(time)Oyrm
Mytime = #4:35:17 PM# 'Assign a timeMyHour = Hour(Mytime) 'MyHour contains 16
Minute FunctionSyntax;
Minute(time)Oyrm
Mtime = #4:35:17 PM# 'Assign a timeMyMinute = Minute(Mytime) 'MyMinute contains 85
Month FunctionSyntax;
Month(date)Oyrm
Mydate = #February 12, 1969# 'Assign a dateMyMonth = Month(Mydate) 'MyMonth contains 2
Second FunctionSyntax;
Second(time)Oyrm
Mytime = Time 'Returns current system timeMySecond = Second(Mytime) 'MySecond contains 17
Weekday FunctionSyntax;
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 FunctionSyntax;
Year(date)
65 Microsoft Visual Basic 6.0
OyrmMyDate = #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 wGifzefwD;&ef/
20/ Run Command Button twGuf -Private Sub Command1_Click()
ClsMyDate = Date 'Assign Current System DateMyDay = Day(MyDate) 'Assign Current System DayMyTime = Time 'Assign Current System TimeMyHour = Hour(MyTime) 'Assign Current System HourMyMinute = Minute(MyTime) 'Assign Current System MinuteMySecond = Second(MyTime)'Assign Current System SecondMyMonth = Month(MyDate) 'Assign Current System MonthMyWeekDay = Weekday(MyDate) 'Assign Current System Day of WeekMyYear = Year(MyDate) 'Assign Current System YearToday = Now 'Assign Current System NowPrint "To Date ", MyDatePrint "To Day ", MyDayPrint "My Time ", MyTime
yHk(72)
uGefysLwmvufpJG 66
Print "My Hour ", MyHourPrint "My Minute ", MyMinutePrint "My Second ", MySecondPrint "My Month ", MyMonthPrint "My Week Day ", MyWeekDayPrint "My Year ", MyYearPrint "Now ", Today
End Sub
21/ txufyg Program udk Run ygu yHk(73)ygtwdkif;azmfjyrnfjzpfonf/
Random FunctionInitializes the random-number generator.
Syntax;Randomize [number]The number argument can be any valid numeric expression.
OyrmRandomize '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 MethodSyntax;
<Object>.Move left, top, width, height<Object>.Left [=value]<Object>.Top [=value]
yHk(73)
67 Microsoft Visual Basic 6.0
22/ atmufyg yHk(74)tm; Move Sample Title Bar jzifhzefwD;xm;&ef -
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 EndEnd Sub
24/ Timer1_Timer twGuf-Private Sub Timer1_Timer()
a = Image1.Leftb = Image1.TopImage1.Move a + 50, b + 33
End Sub
25/ wpfzufyg yHk(75)tm; Move Method Example Title Bar jzifhzefwD;xm;&rnf/
yHk(74)
uGefysLwmvufpJG 68
26/ txufygyHk(75)wGif Image, Command Button wdkYyg0ifMuonf/
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 10Image1.Left = 0Image1.Top = 0i = Image1.Leftk = Image1.TopFor i = 0 To 11500
Image1.Move i, kNextImage1.Left = 11500Image1.Top = 0i = Image1.Leftk = Image1.TopFor k = 0 To 7700
Image1.Move i, kNext
yHk(75)
69 Microsoft Visual Basic 6.0
Image1.Left = 11500Image1.Top = 7700i = Image1.Leftk = Image1.TopFor i = 11500 To 0 Step -1
Image1.Move i, kNextImage1.Left = 0Image1.Top = 7700i = Image1.Leftk = Image1.TopFor k = 7700 To 0 Step -1
Image1.Move i, kNextPrintPrintPrint " ", jBeep
NextEnd Sub
Exit Command Button twGufPrivate Sub Command2_Click()
Unload MeEnd
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/ xdkYaemuf Windows Desktop Status Bar wGif½Sdaom Start Menu
tm;a½G;yg/ xdkYaemuf Setting udkxyfrHa½G;yg/ xdktcg aemufxyf Sub-Menu wpfckay:vmrnf/ 4if;rS Control Panel udka½G;yg/ yHk(76)/
2/ xdktcg Control Panel Dialog Box ay:vmrnf/ yHk(77)/
yHk(76)
71 Microsoft Visual Basic 6.0
yHk(77)
3/ Control Panel Dialog Box ½Sd Icon rsm;xJrS ODBC Data Sources
[32bit] udk Double Click ESdyfyg/ yHk(78)ygtwdkif; ODBC Data Source Adminis-
trator Dialog Box ay:vmrnf/
uGefysLwmvufpJG 72
4/ txufyg Dialog Box wGif User DSN, System DSN, File DSN, Driv-
ers, Tracing, Connection Pooling, About [lí Tab Command 7 ckyg½Sdygonf/4if; Tab Command rsm;xJrS System DSN udka½G;yg/ yHk(79)ygtwdkif;jzpfay:vmrnf/
yHk(78)
73 Microsoft Visual Basic 6.0
5/ txufygyHkwGif Add Command Button udka½G;&rnf/ xdktcg Create New
Data Source Dialog Box ay:vmrnf/ yHk(80)/
6/ txufyg Dialog Box wGif Driver do Microsoft Access [*.mdb] udka½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&mtrnfwpfckudkjznfhpGufyg/ Oyrm Test1 [kjznfhpGufyg/ yHk(81)/
yHk(79)
yHk(80)
uGefysLwmvufpJG 74
yHk(81)
7/ xdkYaemuf Database acgif;pOfatmuf½Sd Select... Command Button udka½G;cs,f&rnf/ xdktcg rdrdtvdk½Sdonfh Access 2002 Database File tm;a½G;cs,fEdkifap&ef Select Database Dialog Box ay:vmayrnf/ yHk(82)/
8/ txufygyHk(82)rS rdrdpdwfBuKduf Database File tm; yHk(83)ygtwdkif;a½G;cs,f&rnf/
yHk(82)
75 Microsoft Visual Basic 6.0
9/ xdk Yaemuf OK Command Button udka½G;cs,f&rnf/ xdktcg ODBC
Microsoft Access Setup Dialog Box odkYjyefvnfa&muf½SdoGm;rnf/ yHk(84)/
10/ txufyg Dialog Box wGif Database: acgif;pOfnmzufwGif rdrda½G;cs,fcJhaomvrf;aMumif;ESifh zdkiftm;jyvdrfhrnf/ Oyrm - c:\My Documents\Test1.mdb/xdkYaemuf Command Button wpfckjzpfaom OK udka½G;cs,f&rnf/
yHk(83)
yHk(84)
uGefysLwmvufpJG 76
11/ xdktcg yHk(85)yg ODBC Data Source Administrator Dialog Box odkYjyefvnfa&muf½SdoGm;NyD; System Data Sources: acgif;pOfatmufwGif Name →→ Test1,
Driver→→Microsoft Access Driver(*.mdb) azmfjyaeayrnf/ xdkYaemuf Command
Button wpfckjzpfaom OK udka½G;cs,f&rnf/ xdktcg 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/
yHk(85)
77 Microsoft Visual Basic 6.0
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -Visual Basic 6.0 wGif ODBC Data Sources qJGwifjcif;12/ Visual Basic 6.0 udkzGifhyg/ Project1-Form1 (Form) ½Sd Form1 wGifatmufygyHk(87)ygtwdkif;wnfaqmufxm;&rnf/
13/ xdkYaemuftcsuftvufzdkifzGifh&ef Command1, y½dk*&rfrSxGuf&ef Com-
mand2 wdkY twGufyHk(88)ygtwdkif; Program rsm;a&;om;&rnf/
yHk(86)
yHk(87)
uGefysLwmvufpJG 78
Data Form Wizard wnfaqmufjcif;14/ Menu Bar ½Sd Add-Ins rS Data Form Wizard udka½G;yg/ yHk(89)/
15/ xdktcg Data Form Wizard - Introduction Dialog Box ay:vmrnf/yHk(90)/
yHk(88)
yHk(89)
yHk(90)
79 Microsoft Visual Basic 6.0
16/ yHk(90)yg Dialog Box wGif From what profile do you want to load
your setting? acgif;pOfatmuf List Box udk (None) xm;NyD; Next udka½G;yg/
17/ xdktcg txufygyHk(91)ygtwdkif; Data Form Wizard - Database Type
Dialog Box ay:vmNyD; 4if;xJ½Sd List Box xJwGif Access udka½G;xm;vdrfhrnf/ rdrdrSRemote (ODBC) tm;a½G;NyD; Next udka½G;cs,f&rnf/
18/ xdktcg yHk(92)ygtwdkif; Data Form Wizard - Connect Information
Dialog Box ay:vmNyD; ODBC Connect Data acgif;pOfatmuf½Sd DSN: nmzuf½SdList 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)/
yHk(91)
yHk(92)
uGefysLwmvufpJG 80
yHk(93)
yHk(94)
19/ xdktcg Data Form Wizard - Form Dialog Box ay:vmrnf/ What
name do you want for the form? acgif;pOfatmuf List Box wGif rdrdBuKdufESpfouf&mtrnfudk jznfhpGuf&ef/ Oyrm - Form2 [kjznfhpGufí Next udka½G;&rnf/ yHk(95)/
81 Microsoft Visual Basic 6.0
20/ yHk(95)wGif Next udka½G;cs,fygu Data Form Wizard - Record Source
Dialog Box ay:vmrnf/
21/ txufygyHkwGif Record Source: List Box Dropdown Arrow tm;a½G;cs,fNyD; Test1 udkxm;&ef/ xdktcg Available Fields:acgif;pOfatmufwGif Test1 Data-
base File wGif wnfaqmufxm;aom Field rsm;a&muf½Sdvmvdrfhrnf/ 4if;rS rdrdESpfoufonfh Field rsm;udka½G;cs,f&rnf/ yHk(97)/
yHk(95)
yHk(96)
uGefysLwmvufpJG 82
yHk(97)
yHk(98)
22/ txufygyHk(97)wGif rdrdtvdk½Sdonfh Field rsm;udkwpfckcsif;tvdkuf Right
Arrow Command Button jzifhvnf;aumif;? Field tm;vHk;udk Right Arrow ESpfckyg Command Button jzifhvnf;aumif;a½G;cs,fEdkifygonf/ Column to Sort By:
acgif;pOfatmuf List Box wGif rdrdtaejzifh i,fpOfBuD;vdkufpDpOfvdkaom Field rsm;udka½G;cs,fvdku a½G;cs,fEdkifygonf/ xdkYaemuf Next udka½G;cs,fyg/ yHk(98)/
83 Microsoft Visual Basic 6.0
23/ wpfzufygyHk(98)yg Data Form Wizard - Record Source Dialog Box
wGif Next udkxyfrHa½G;cs,fyg/ Data Form Wizard - Control Selection Dialog
Box ay:vmrnf/ yHk(99)/
24/ txufygyHk(99)udk ajymif;vJrIrjyKvkyfbJ Next udkxyfrHa½G;cs,fyg/ xdktcgData Form Wizard - Finished! Dialog Box ay:vmayrnf/ yHk(100)/
25/ txufygyHk(100)wGif Finish Command Button udka½G;cs,f&rnf/ yHk(101)/
yHk(99)
yHk(100)
uGefysLwmvufpJG 84
26/ yHk(101)wGif OK udka½G;cs,f&rnf/ xdktcg yHk(102)ygtwdkif;jzpfay:vmrnf/
27/ Visual Basic 6.0 rS tvdktavsmufwnfaqmufay;vdkufaom Form2 jzpfay:vmayrnf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(101)
yHk(102)
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/ atmufazmfjyygyHk(103)tm; Toolbox ½Sd Icon rsm;udktoHk;jyKíwnfaqmufxm;&rnf/
29/ yHk(103)yg Form wGif Command Button udktoHk;jyKí zdkifzGifh&ef? xGuf&efwdkYudk zefwD;wnfaqmufxm;ygonf/ tqdkyg Form onf Form1 jzpfNyD;xGuf&ef Com-
mand Button udkESdyfygu 4if;y½dk*&rfxJrSxGufoGm;NyD;? zdkifzGifh&ef Command Button
udka½G;ygu Form2 jzifhpDpOfxm;aom Microsoft Access 2002 Database File ay:vmayrnf/ xdkYaMumifh Form2 udkatmufygtwdkif;wnfaqmuf&ayrnf/ yHk(104)/
yHk(103)
yHk(104)
uGefysLwmvufpJG 86
30/ yHk(104)yg Identification Number;, Rank;, Name;, Department; [kteufa&mifjzifha&;om;xm;aompmrsm;onf Label1, Label2, Label3, Label4 wdkYjzifhwnfaqmufxm;jcif;jzpfNyD; 4if;pmom;rsm;\nmzufwGifwnfaqmufxm;aom Box rsm;rSm Text Box rsm;jzifhwnfaqmufxm;ygonf/ Add, Update, Delete, Refresh, Close
wdkYrSm Command Button rsm;jzpfMuygonf/ 4if; Command Button 5 ck\nmzufwGif½Sdonfh Data Position Box rSm jzifhwnfaqmufxm;ygonf/ Command
Button rsm;ESifh Adodc wdkYatmufzufwGif½Sdaeaom Z,m;udk jzifhwnfaqmufxm;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 yHk(105)? yHk(106)wdkYjzifhazmfjytyfygonf-(u) ConnectionString - P rov ide r=MSDASQL.1 ;DSN=
TEST1; UID=; PWD=;( c) RecordSource - Select [Identification Number], Rank,
Name, Department from Test1 OrderBy [Identification Number]
yHk(105) yHk(106)
89 Microsoft Visual Basic 6.0
yHk(107) yHk(108)
45/ DataGrid1 DataGrid \ Properties udk yHk(107)? yHk(108)wdkYjzifhazmfjytyfygonf/ txufyg Form2 udk Run í&Edkifap&eftwGuf vdktyfaomy½dk*&rfrsm;a&;om;&ayrnf/
46/ Adodc1 Adodc wGif Record Position twGuf-Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset AsADODB.Recordset)
Adodc1.Caption ="Record: " & CStr(Adodc1.Recordset. Absolute Position)
End Sub
uGefysLwmvufpJG 90
47/ Add Command Button twGuf-Private Sub Command1_Click() Adodc1.Recordset.AddNewEnd Sub
48/ Update Command Button twGuf-Private Sub Command2_Click() Adodc1.Recordset.UpdateEnd Sub
49/ Delete Command Button twGufPrivate Sub Command3_Click() With Adodc1.Recordset .Delete .MoveNext If .EOF Then .MoveLast End WithEnd Sub
50/ Refresh Command Button twGuf-Private Sub Command4_Click() Adodc1.RefreshEnd Sub
51/ Close Command Button twGuf-Private Sub Command5_Click() Form2.Hide Form1.ShowEnd Sub
52/ Mouse Pointer Position twGuf-Private Sub Form_Unload(Cancel As Integer) Screen.MousePointer = vbDefaultEnd 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 withvalues 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 typeVariant because its type is omitted.
Dim AnotherVar, Choice As Boolean, BirthDate As Date
'DayArray is an array of Variants with 51 elements indexed, from 0thru 50, assuming Option Base is set to 0 (default) for thecurrent 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 yHkpHtm;zefwD;wnfaqmufyg/ yHk(109)/
2/ txufyg Form yHkpHwGif Label, Text Box, Command Button wdkYjzifhzefwD;xm;NyD; Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&efjzpfygonf/
3/ Run Command Button twGuf-Private Sub Command1_Click()
ClsDim a(50) As Variantw = Text1.Textb = 0z = Len(Text1.Text)Print z: PrintFor i = 1 To z
a(i) = Left(Right(Str(w), z - i + 1), 1)Print a(i) & "+";
NextFor i = 1 To z
b = b + Val(a(i))NextPrint "=", bc = Len(b)d = 0Print c: PrintFor j = 1 To c
yHk(109)
uGefysLwmvufpJG 94
a(j) = Left(Right(Str(b), c - j + 1), 1)Print a(j) & "+";
NextFor i = 1 To c
d = d + Val(a(i))NextPrint "=", de = Len(d)f = 0Print e: PrintIf e >= 2 And d >= 10 Then
For j = i To ca(j) = Left(Right(Str(d), e - j + 1), 1)Print a(j) & "+";
NextFor i = 1 To e
f = f + Val(a(i))NextPrint "=", f
End IfEnd Sub
4/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
5/ tqdkyg y½dk*&rfudk Run ygu yHk(110)twdkif;jrifawGU&rnf/
95 Microsoft Visual Basic 6.0
Syntax;RSet strinvar = stringOyrm -MyString = "0123456789" 'Initialize String.RSet MyString = "Right ->" 'MyString contains " Right ->".
String toHk;jyKí Fibonacci Sequence udef;pOfwef;udk½Smjcif;6/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(111)/ 4if;wGif Label,
Text Box, Command Button wdkYjzifhzefwD;xm;NyD; Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&efjzpfygonf/
7/ Run Command Button twGuf-Private Sub Command1_Click()
Dim n As Variantstr1 = "1234567"Clsn = Text1: secondlast = 0: Last = 1
yHk(110)
yHk(111)
uGefysLwmvufpJG 96
For k = 3 To nterm = secondlast + Last: secondlast = Last: Last = termRSet str1 = Str(term)Print k, str1
NextEnd Sub
8/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
9/ tqdkygy½dk*&rfudk Run ygu atmufygyHkpHtwdkif;jrifawGU&rnf/ yHk(112)/
Astrisk rsm;zefwD;jcif;
yHk(112)
97 Microsoft Visual Basic 6.0
10/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(113)/ 4if;wGif Command
Button rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
11/ Run Command Button twGuf-Private Sub Command1_Click()
Dim a$(22, 21)ClsFor i = 1 To 22
For j = 1 To 21a$(i, j) = "*"
Next jNext iFor i = 1 To 20
For j = 1 To 21 - ia$(i, j) = "*"
Next jNext iFor i = 1 To 22
For j = 1 To 21Print a$(i, j);
Next j: Print Next iEnd Sub12/ Exit Command Button twGuf-
yHk(113)
uGefysLwmvufpJG 98
Private Sub Command2_Click() Unload Me EndEnd Sub
13/ tqdkygy½dk*&rfudk Run ygu atmufygyHkpHtwdkif;jrifawGU&rnf/ yHk(114)/
Magic Square y½dk*&rfa&;om;jcif;14/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(115)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGifvdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
15/ Run Command Button twGuf-
yHk(114)
yHk(115)
99 Microsoft Visual Basic 6.0
Private Sub Command1_Click()str1 = "12345"
10 ClsN = Val(Text1)If N >= 31 Or N Mod 2 = 0 Then
Print "Between 3 and 19 ": GoTo 10End IfDim A(31, 31)For i = 1 To N
For j = 1 To NA(i, j) = 0
Next jNext idat = 1: i = 1: j = N \ 2 + 1: A(i, j) = datFor Kount = 1 To N * N - 1
i = i - 1: j = j + 1If i < 1 And j > N Then i = i + 2: j = j - 1If i < 1 Then i = NIf j > N Then j = 1If A(i, j) <> 0 Then i = i + 2: j = j - 1dat = dat + 1: A(i, j) = dat
Next: PrintPrint " Magic Square "; NPrint " ~~~~~~~~~~~~ ": PrintFor i = 1 To N
For j = 1 To NRSet str1 = A(i, j): Print str1;
'Print using;" ";str1; 'A(i,j);Next j: Print
Next iEnd Sub
16/ Exit Command Button twGufPrivate Sub Command2_Click()
Unload MeEnd
uGefysLwmvufpJG 100
End Sub
17/ tqdkygy½dk*&rfudk Run ygu atmufygyHk(116)twdkif; azmfjyrnfjzpfonf/
&m*Pef;½dkufxnfhygu 4if;udef;*Pef; 3 vHk;pvHk;aygif;jcif;18/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(117)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGifvdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
19/ Run Command Button twGuf-Private Sub Command1_Click()
Clsn = Text1.TextA = n \ 100n = n - (A * 100)b = n \ 10n = n - (b * 10)
yHk(116)
yHk(117)
101 Microsoft Visual Basic 6.0
Print "("; A; "+"; b; "+"; n; ")"; "="; A + b + nEnd Sub
20/ Exit Command Button twGufPrivate Sub Command2_Click()
Unload MeEnd
End Sub
21/ tqdkygy½dk*&rfudk Run ygu yHk(118)twdkif; azmfjyrnfjzpfonf/
aemufwpfenf;22/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(119)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGifvdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
23/ Run Command Button twGuf-Private Sub Command1_Click()
Clsn = Text1.Textsum1 = 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
yHk(118)
yHk(119)
uGefysLwmvufpJG 102
24/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
25/ tqdkygy½dk*&rfudk Run ygu yHk(120)twdkif; azmfjyrnfjzpfonf/
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 yHkpHtm; zefwD;wnfaqmufyg/ yHk(121)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGifvdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
27/ Run Command Button twGuf-Private Sub Command1_Click()
Clsn = Text1.Text
yHk(120)
yHk(121)
103 Microsoft Visual Basic 6.0
s1 = Val(Mid(Trim(Str(n)), 1, 1))Print s1s2 = Val(Mid(Trim(Str(n)), 2, 1))Print s2s3 = Val(Mid(Trim(Str(n)), 3, 1))Print s3Print "3 Digits Sum of "; n; " is"; s1 + s2 + s3
End Sub
28/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
29/ tqdkygy½dk*&rfudk Run ygu yHk(122)twdkif; azmfjyrnfjzpfonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(122)
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/
2/ Run Command Button twGuf-Private Sub Command1_Click() 'To find No., AP, GP, Square
ClsPrint 1, 1, 1, 1For j = 2 To 22
Print j, 2 * j - 1, 2 ^ (j - 1), j ^ 2Next
End Sub
3/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
4/ tqdkygy½dk*&rfudk Run ygu yHk(124)twdkif; azmfjyrnfjzpfonf/
yHk(123)
105 Microsoft Visual Basic 6.0
APudef;pOfwef;udk y½dk*&rfa&;om;jcif;5/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(125)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGifvdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
6/ Properties rsm;udkjyifqifjznfhpGufNyD;aemuf vdktyfaomy½dk*&rfrsm;udka&;om;&rnf/
yHk(124)
yHk(125)
uGefysLwmvufpJG 106
7/ Run Command Button twGuf-Private Sub Command1_Click()
'AP (Arithmetic Progression)Clsa = Val(Text1)d = Val(Text2)n = Val(Text3)Print " No? Terms Sum "k = 1: t = a: s = aPrint k, t, sFor k = 2 To n
t = t + d: s = s + t: Print k, t, sNext
End Sub
8/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
9/ tqdkygy½dk*&rfudk 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 yHkpHtm; zefwD;wnfaqmufyg/ yHk(127)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGifvdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
11/ Run Command Button twGuf-Private Sub Command1_Click()
'GP (Arithmetic Progression)Clsa = Val(Text1)d = Val(Text2)n = Val(Text3)Print " No? Terms G.P Sum "k = 1: t = a: s = aPrint k, t, sFor k = 2 To n
t = t * d: s = s + t: Print k, t, sNext
End Sub
12/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
yHk(127)
uGefysLwmvufpJG 108
13/ tqdkygy½dk*&rfudk Run ygu yHk(128)twdkif; azmfjyrnfjzpfonf/
S = 1 + 2 + 3 + ... + N udef;pOfwef;wdkYudk aygif;jcif;14/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(129)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Properties toD;oD;udk jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
15/ Run Command Button twGuf-Private Sub Command1_Click()
'To find the sum of N terms of the series'S = 1 + 2 + 3 + ... + NClsn = Val(Text1)If n = 0 Then EndSum = 1For i = 2 To n
Sum = Sum + i
yHk(128)
yHk(129)
109 Microsoft Visual Basic 6.0
NextPrint "The sum of the series is "; Sum Print k, t, s
End Sub
16/ Exit Command Button twGufPrivate Sub Command2_Click()
Unload MeEnd
End Sub
17/ tqdkygy½dk*&rfudk Run ygu yHk(130)twdkif; azmfjyrnfjzpfonf/
S = 1 * 2 * 3 * ... * N udef;pOfwef;wdkYudk aygif;jcif;18/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(131)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Properties toD;oD;udk jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
19/ Run Command Button twGuf-Private Sub Command1_Click()
'To find the Product of N terms of the series'S = 1 * 2 * 3 * ... * NClsn = Val(Text1)If n = 0 Or n > 17 Then Endpro = 1
yHk(130)
yHk(131)
uGefysLwmvufpJG 110
For i = 2 To npro = pro * i
NextPrint "The Product of the series is "; pro
End Sub
20/ Exit Command Button twGufPrivate Sub Command2_Click()
Unload MeEnd
End Sub
21/ tqdkygy½dk*&rfudk Run ygu yHk(132)twdkif; azmfjyrnfjzpfonf/
udef;pOfwef; S = 1 + 1/4 + 1/9 + ... + 1/N*N wdkYudk½SmazGjcif;22/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(133)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Properties toD;oD;udk jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
23/ Run Command Button twGuf-Private Sub Command1_Click()
Clsn = Text1If n = 0 Then Endsum1 = 0
yHk(132)
yHk(133)
111 Microsoft Visual Basic 6.0
For i = 1 To nsum1 = sum1 + 1 / i ^ 2
NextPrint "The Sum of the series is "; sum1
End Sub
23/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
24/ tqdkygy½dk*&rfudk Run ygu yHk(134)twdkif; azmfjyrnfjzpfonf/
udef;pOfwef; P = (2/3)(3/4)(4/5)...(N/N+1) wdkYudk½SmazGjcif;25/ atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(135)/ 4if;wGif ,
, rsm;jzifhzefwD;xm;NyD; Properties toD;oD;udk jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
26/ Run Command Button twGuf-Private Sub Command1_Click()
Clsn = Text1If n = 0 Or n > 18 Then Endpro = 1
yHk(134)
yHk(135)
uGefysLwmvufpJG 112
For i = 1 To n pro = pro * (i + 1) / (i + 2)
NextPrint "The Product of the series is "; pro
End Sub
27/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
28/ tqdkygy½dk*&rfudk Run ygu yHk(136)twdkif; azmfjyrnfjzpfonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(136)
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;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&efjzpfygonf/
2/ Command1 Button twGuf-Private Sub Command1_Click() Form1.Hide Form2.ShowEnd Sub
3/ Command2 Button twGuf-Private Sub Command2_Click() Unload Me EndEnd Sub
4/ xdkYaemuf Form2 yHkpHtm;zefwD;wnfaqmufxm;&rnf/ yHk(138)/ 4if;wGif , , , rsm;jzif hzefwD;xm;NyD;
Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
yHk(137)
uGefysLwmvufpJG 114
yHk(138)
5/ rSm jzifhwnfaqmufxm;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 fromTest2
115 Microsoft Visual Basic 6.0
6/ Connection String \ nmzuf Box wGif Cursor csygu Ellipsis trSwftom;yg Command Button udk Mouse Left Click jzifha½G;cs,fygu yHk(141)ygtwdkif; Property Pages Dialog Box ay:vmrnf/ General Tab Command Button
udka½G;cs,fyg/ Use Connection String [ka&;om;xm;onfh Option Button udka½G;cs,fyg/ xdkYaemuf4if;acgif;pOfatmuf List Box ü PROVIDER=MSDASQL;dsn=Test2;
uid=;pwd=;udkjznfhpGufí OK udka½G;cs,f&ayrnf/
yHk(139) yHk(140)
uGefysLwmvufpJG 116
7/ RecordSource \ nmzuf Box wGif Cursor csygu Ellipsis trSwftom;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 wGifCursor xnfhyg/ xdkYaemuf Select [Roll Number], Name,Myanmar,English,
Maths, Total from Test2udkjznfhpGufí OK udka½G;cs,f&ayrnf/
8/ Text1 Text Box \ Properties wGifatmufygtwdkif;jyifqifjznfhpGuf&ef-(u) DataSource - Wado( c) DataField - Roll Number( *) Text - Empty
yHk(141)
yHk(142)
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.UpdateWado.Recordset.MoveNext
Loop
uGefysLwmvufpJG 118
Wado.Recordset.MoveFirstEnd Sub
16/ rlvae&modkYjyefoGm;jcif; Command Button twGuf-Private Sub Command2_Click()
Form2.HideForm1.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/ tqdkygy½dk*&rfudk 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;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
20/ zdkifzGihfjcif; Command Button twGuf-Private Sub Command1_Click() Form1.Hide Form2.ShowEnd Sub
21/ xGufjcif; Command Button twGuf-Private Sub Command2_Click() Unload Me EndEnd Sub
22/ xdkYaemuf Form2 yHkpHtm;zefwD;wnfaqmufxm;&rnf/ þuJhodkYwnfaqmuf&mwGif Adodc, DataGrid rsm; Toolbox xJwGif½Sd&efvdktyfayonf/ Toolbox xJ½SdIcon vGwfaeaomrsufESmjyiftm; Mouse Pointer jzifhaxmufí Right Click udka½G;cs,fyg/ xdktcg yHk(145)ygtwdkif; Short Cut Menu wpfckay:vmayrnf/
yHk(144)
uGefysLwmvufpJG 120
23/ yHk(145)yg Short Cut Menu rS Components... udka½G;cs,f&rnf/ xdktcgyHk(146)ygtwdkif; Components Dialog Box ay:vmrnf/
24/ Controls Tab Command acgif;pOfatmuf Vertical Scroll Bar rSDropdown Arrow udktoHk;jyKNyD; Adodc ESifh DataGrid wdkY½Sdonfhae&mrsm;udk Check
jyKvkyf&rnf/ yHk(147)/
yHk(145)
yHk(146)
121 Microsoft Visual Basic 6.0
25/ xdkYaemuf Apply Command Button udka½G;cs,fyg/ 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½Sdvmrnf/ yHk(148)/
yHk(147)
yHk(148)
uGefysLwmvufpJG 122
26/ xdkYaemuf Form2 yHkpHtm;zefwD;wnfaqmufxm;&rnf/ yHk(149)/ 4if;wGif
, , , rsm;jzifhzefwD;xm;NyD; Properties rsm;udk
jyifqifjznfhpGufí Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
27/ DataGrid \ Properties wGif atmufygwdkYudkjyifqifjznfhpGuf&ef/ yHk(150)-(u) AllowAddnew - True
( c) AllowArrows - True
( *) AllowDelete - True
(C) AllowUpdate - True
( i) DataSource - Wado
yHk(149)
123 Microsoft Visual Basic 6.0
28/ xdkYaemuf DataGrid ay:odkY Mouse Left Click jzifha½G;cs,fNyD; Mouse
Right Click udkESdyfyg/ yHk(151)yg Short Cut Menu ay:vmygu Retrieve Fields udkxyfrHa½G;cs,f&rnf/
yHk(150)
uGefysLwmvufpJG 124
29/ xdktcg yHk(152)yg Retrieve fields Dialog Box ay:vmygu Yes udkxyfrHa½G;cs,fyg/
30/ yHk(153)ygtwdkif; DataGrid xJwGif oufqdkif&m Fields udkawGU½Sd&ayrnf/
yHk(151)
yHk(152)
125 Microsoft Visual Basic 6.0
yHk(153)
31/ (3)bmomaygif;jcif; Command Button twGuf-Private Sub Command1_Click()
Wado.Recordset.MoveFirstDo While Wado.Recordset.EOF = False
Wado.Recordset("Total") = Wado.Recordset("Myanmar") +Wado.Recordset("English") + Wado.Recordset("Maths")Wado.Recordset.UpdateWado.Recordset.MoveNext
LoopWado.Recordset.MoveFirst
End Sub
32/ rlvae&modkYjyefoGm;jcif; Command Button twGuf-Private Sub Command2_Click() Form2.Hide Form1.ShowEnd Sub
uGefysLwmvufpJG 126
33/ Record Position jyo&eftwGuf-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/ tqdkygy½dk*&rfudk Run ygu yHk(154)twdkif; azmfjyrnfjzpfonf/
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*&rfa&;om;rnfqdku yxrOD;pGmyHk(155)ygtwdkif; Form1 udkwnfaqmuf&rnf/
yHk(154)
127 Microsoft Visual Basic 6.0
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.ShowEnd Sub
38/ xGufjcif; Command Button twGuf-Private Sub Command2_Click() Unload Me EndEnd Sub
39/ xdkYaemuf Form2 yHkpHtm; yHk(156)ygtwdkif; zefwD;wnfaqmufxm;&rnf/
yHk(155)
uGefysLwmvufpJG 128
40/ (3)bmomaygif;jcif; Command Button twGuf-Private Sub Command1_Click()
Wado.Recordset.MoveFirstb = 1 'Record CounterDo 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 ThenWado.Recordset("Result") = "Fail"
ElseWado.Recordset("Result") = "Pass"
End IfIf Wado.Recordset("Myanmar") < 40 And Wado.Recordset("English")
< 40 And Wado.Recordset("Maths") < 40 ThenWado.Recordset("Amount of Fail") = "3"
ElseIf Wado.Recordset("Myanmar") < 40 AndWado.Recordset("English") < 40 AndWado.Recordset("Maths") >= 40 ThenWado.Recordset("Amount of Fail") = "2"
yHk(156)
129 Microsoft Visual Basic 6.0
ElseIf Wado.Recordset("Myanmar") < 40 AndWado.Recordset("English") >= 40 AndWado.Recordset("Maths") < 40 ThenWado.Recordset("Amount of Fail") = "2"
ElseIf Wado.Recordset("Myanmar") >= 40 AndWado.Recordset("English") < 40 AndWado.Recordset("Maths") < 40 ThenWado.Recordset("Amount of Fail") = "2"
ElseIf Wado.Recordset("Myanmar") < 40 AndWado.Recordset("English") >= 40 AndWado.Recordset("Maths") >= 40 ThenWado.Recordset("Amount of Fail") = "1"
ElseIf Wado.Recordset("Myanmar") >= 40 AndWado.Recordset("English") < 40 AndWado.Recordset("Maths") >= 40 ThenWado.Recordset("Amount of Fail") = "1"
ElseIf Wado.Recordset("Myanmar") >= 40 AndWado.Recordset("English") >= 40 AndWado.Recordset("Maths") < 40 ThenWado.Recordset("Amount of Fail") = "1"
ElseWado.Recordset("Amount of Fail") = Null
End IfWado.Recordset.UpdateWado.Recordset.MoveNextb = b + 1
LoopWado.Recordset.MoveFirstText1.Text = b - 1
End Sub
41/ rlvae&mjyefoGm;jcif; Command Button twGuf-Private Sub Command2_Click()
Form2.HideForm1.Show
End Sub
uGefysLwmvufpJG 130
42/ tqdkygy½dk*&rfudk Run ygu yHk(157)twdkif; azmfjyrnfjzpfonf/
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½SdQuery File wpfckwnfaqmufxm;yg/ xdkYaemuf Visual Basic 6.0 jzifhy½dk*&rfa&;om;rnfqdku yxrOD;pGmyHk(158)ygtwdkif; Form1 udkwnfaqmuf&rnf/
yHk(157)
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 twGufPrivate Sub Command1_Click() Form1.Hide Form2.ShowEnd Sub
46/ xGufjcif; Command Button twGufPrivate Sub Command2_Click() Unload Me EndEnd Sub
47/ xdkYaemuf Form2 yHkpHtm; yHk(159)ygtwdkif; zefwD;wnfaqmufxm;&rnf/
yHk(159)
uGefysLwmvufpJG 132
48/ Adodc \ Properties wGifatmufygwdkYudkjyifqifjznfhpGuf&ef-(Name) - WadoCaption - EmptyConnectionString - 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.MoveFirstp = Wado.Recordset("Total") 'Initialize Totalq = Wado.Recordset("Result") 'Initialize Resultr = Wado.Recordset("Amount of fail") 'Initialize Amount of Faila = 1 'Duplicate Totalb = 1 'Record CounterDo 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 ThenWado.Recordset("Result") = "Fail"
ElseWado.Recordset("Result") = "Pass"
End IfIf Wado.Recordset("Myanmar") < 40 And Wado.Recordset("English")
< 40 And Wado.Recordset("Maths") < 40 ThenWado.Recordset("Amount of Fail") = "3"
ElseIf Wado.Recordset("Myanmar") < 40 AndWado.Recordset("English") < 40 AndWado.Recordset("Maths") >= 40 ThenWado.Recordset("Amount of Fail") = "2"
ElseIf Wado.Recordset("Myanmar") < 40 AndWado.Recordset("English") >= 40 AndWado.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 AndWado.Recordset("Maths") < 40 ThenWado.Recordset("Amount of Fail") = "2"
ElseIf Wado.Recordset("Myanmar") < 40 AndWado.Recordset("English") >= 40 AndWado.Recordset("Maths") >= 40 ThenWado.Recordset("Amount of Fail") = "1"
ElseIf Wado.Recordset("Myanmar") >= 40 AndWado.Recordset("English") < 40 AndWado.Recordset("Maths") >= 40 ThenWado.Recordset("Amount of Fail") = "1"
ElseIf Wado.Recordset("Myanmar") >= 40 AndWado.Recordset("English") >= 40 AndWado.Recordset("Maths") < 40 ThenWado.Recordset("Amount of Fail") = "1"
ElseWado.Recordset("Amount of Fail") = Null
End IfIf (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")) ThenWado.Recordset("Position") = a
ElseIf (p = Wado.Recordset("Total") And Wado.Recordset("Result")= "Fail") Thena = a + 1Wado.Recordset("Position") = ba = b
Elsea = a + 1Wado.Recordset("Position") = ba = b
End If
uGefysLwmvufpJG 134
p = Wado.Recordset("Total") 'Initialize Totalq = Wado.Recordset("Result") 'Initialize Resultr = Wado.Recordset("Amount of fail") 'Initialize Amount of FailWado.Recordset.UpdateWado.Recordset.MoveNextb = b + 1
LoopWado.Recordset.MoveFirstText1.Text = b - 1
End Sub
50/ rlvae&mjyefoGm;jcif; Command Button twGuf-Private Sub Command2_Click()
Form2.HideForm1.Show
End Sub
51/ tqdkygy½dk*&rfudk Run ygu yHk(160)twdkif; azmfjyrnfjzpfonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(160)
135 Microsoft Visual Basic 6.0
Chapter (8)
Data Types rsm;\*kPfowådrsm;
Data TypeByteBooleanIntegerLong(long integer)Single(single precisionfloating-pointDouble(double-precisionfloating-point
Currency(scaled integer)Decimal
DateObjectString(variable-length)String(fixed-length)Variant(with numbers)Variant(with characters)User-defined(using type)
Storage Size1 byte2 bytes2 bytes4 bytes
4 bytes
8 bytes
8 bytes
14 bytes
8 bytes4 bytes10 bytes+ string lengthLength of string
16 bytes
22 bytes+string lengthNumberrequired byelements
Range0 to 255True or False-32,768 to 32767-2,147,483,648 to 2,147,483,647
-3.402823E38 to -1.401298E-45 for negativevalues; 1.401298E-45 to 3.402823E38 forpositive values-1.79769313486232E308 to-4.94065645841247E-324 for negativevalues; 4 .94065645841247E-324 to1.79769313486232E308 for positive values-922,337,203,685,477.5808 to922,337,203,685,477.5808+/-79,228,162,514,264,337,593,543,950,335with no decimal point;+/-79,228,162,514,264,337,593,543,950,335with 28 places to the right of the decimal point;smallest nonzero number is+/-0.00000000000000000000000000001January 1, 100 December 31, 9999Any Object reference0 to approximately 2 billion
1 to approximately 65,400
Any numeric value up to the range of a Double
Same range as for variable-length String
The range of each element is the same as therange of its data type
uGefysLwmvufpJG 136
erlemy½dk*&rfrsm;
1/ yHk(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 = DateEnd Sub
5/ Exit Command Button twGuf-Private Sub Command2_Click() Unload Me EndEnd Sub
yHk(161)
137 Microsoft Visual Basic 6.0
6/ Form Click twGuf-Private Sub Form_Click() Text1.Font.Bold = TrueEnd Sub
7/ Image1 Click twGuf-Private Sub Image1_Click() Image1.Move Image1.Left + 50, Image1.Top - 550 MsgBox "Hello"End Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
8/ yHk(162)yg Form wGif , , ,
wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemufCommand Button toD;oD;wGif vdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
9/ Picture1 PictureBox \ Properties rSm -(Name) - Picture1AutoSize - FalsePicture - "C:\WINDOWS\SETUP.BMP"
10/ Text1 TextBox \ Properties rSm -Font - MS Sans Serif, Regular, 14Text - Empty
yHk(162)
uGefysLwmvufpJG 138
11/ Command1 Button twGuf-Private Sub Command1_Click() Command1.Caption = Text1.TextEnd Sub
12/ Exit Command Button twGuf-Private Sub Command2_Click() Unload Me EndEnd Sub
Private Sub Form_Load() Picture1.Picture = LoadPicture("c:\windows\setup.bmp") Label1.Caption = Date Label2.Caption = TimeEnd Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii > 47 And KeyAscii <= 58 Then KeyAscii = 8 End IfEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(163)
139 Microsoft Visual Basic 6.0
13/ yHk(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.TextEnd Sub
16/ Exit Command Button twGuf -Private Sub Command2_Click() Unload Me EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(164)
uGefysLwmvufpJG 140
17/ yHk(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 IntegerFor i = 0 To List2.ListCount - 1
If List2.Selected(i) ThenList1.AddItem List2.List(i)
End IfNext iFor i = List2.ListCount - 1 To 0 Step -1
If List2.Selected(i) ThenList2.RemoveItem (i)
End IfNext i
End Sub
19/ << Command Button twGuf -Private Sub Command2_Click()
Dim i As IntegerFor i = 0 To List1.ListCount - 1
If List1.Selected(i) ThenList2.AddItem List1.List(i)
End IfNext iFor i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) ThenList1.RemoveItem (i)
End IfNext i
End Sub
141 Microsoft Visual Basic 6.0
20/ Add Command Button twGuf -Private Sub Command3_Click()
List1.AddItem Text1.TextEnd Sub
21/ Exit Command Button twGuf -Private Sub Command4_Click()
Unload MeEnd
End Sub- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
Looping StructureDo ... LoopFor ... NextFor Each ... Next
Do While ... LoopDo While <Condition>
[Statements][Exit Do][Statements]
Loop
Do Until ... LoopDo 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 - - - - - - - - - - - - - - -
22/ yHk(165)yg Form wGif wdkYjzifhwnfaqmufxm;NyD; Properties
rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif vdktyfaom y½dk*&rfrsm;udk a&;om;&ayrnf/
23/ General, Declaration wGif-Private Sub Demoloop()
n = 1Do While n <= 10
MsgBox nn = n + 1
LoopEnd Sub
yHk(165)
143 Microsoft Visual Basic 6.0
Private Sub Demoloop1()Dim i As Integeri = 10Do Until i < 1
MsgBox ii = i - 1If i = 6 Then
Exit DoEnd If
LoopEnd Sub
24/ Command1 Command Button twGuf -Private Sub Command1_Click()
DemoloopEnd Sub
25/ Command2 Command Button twGuf -Private Sub Command2_Click()
Demoloop1End Sub
For ... NextFor Counter = Start To End [Step Increment]
[Statements]Next
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
uGefysLwmvufpJG 144
26/ yHk(165)yg Form wGif jzifhwnfaqmufxm;NyD; Properties
rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button wGif vdktyfaomy½dk*&rfrsm;udka&;om;&ayrnf/
27/ Command1 Command Button wGif-Private Sub Command1_Click() Unload Me EndEnd 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) NextEnd Sub
yHk(166)
145 Microsoft Visual Basic 6.0
Select CaseSelect Case <testexpression>
[Case <expressionlist1>[Statementblock-1]]
[Case <expressionlist2>[Statementblock-2]]...
[Case Else[Statementblock-n]]
End Select
InputBoxInputBox(Prompt[,Title][,default][,xpos][,ypos][,helpfile,context])
MessageBoxMessageBox(Prompt[,buttons][,Title][,helpfile,context])
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
29/ yHk(167)yg Form wGif , , wdkYjzifhwnfaqmufxm;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 "+"
yHk(167)
uGefysLwmvufpJG 146
Text3.Text = num1 + num2Case "-"
Text3.Text = num1 - num2Case "*"
Text3.Text = num1 * num2Case "/"
Text3.Text = num1 / num2End Select
End Sub
31/ Exit Command Button twGuf -Private Sub Command2_Click() Unload Me EndEnd 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 - - - - - - - - - - - - - - -
33/ yHk(168)yg Form wGif , , wdkYjzifh
wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
yHk(168)
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 EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
36/ yHk(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
yHk(169)
uGefysLwmvufpJG 148
38/ Exit Command Button twGuf -Private Sub Command2_Click() Unload Me EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
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 = 0End Sub
41/ Interval Hundred Command Button twGuf -Private Sub Command2_Click() Timer1.Interval = 100End Sub
42/ Exit Command Button twGuf -Private Sub Command3_Click() Unload Me EndEnd Sub
yHk(170)
149 Microsoft Visual Basic 6.0
43/ Timer1 Timer twGuf -Private Sub Timer1_Timer()
Dim i As IntegerLabel1.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;jzifhazmfjytyfygonf/
Pointer PictureBox Label
TextBox Frame Command Button
CheckBox OptionButton ComboBox
ListBox HScrollBar VScrollBar
Timer DriveListBox DirListBox
FileListBox Shape Line
Image DataControl OLE
uGefysLwmvufpJG 150
45/ yHk(171)yg Form wGif FileListBox, DriveListBox,
DirListBox, Image, wdkYjzifh wnfaqmufxm;NyD; Properties
rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGifvdktyfaom y½dk*&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 EndEnd Sub
yHk(171)
151 Microsoft Visual Basic 6.0
50/ Directory Change &eftwGuf -Private Sub Dir1_Change() File1.Path = Dir1.PathEnd Sub
51/ Drive Change &eftwGuf -Private Sub Drive1_Change() Dir1.Path = Drive1.DriveEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
52/ yHk(172)yg Form wGif Frame , Shape, HScrollBar, ,
VScrollBar, CheckBox, OptionButton, wdk Y jzif hwnfaqmufxm;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 EndEnd Sub
54/ Horizontal Scroll Bar twGuf -Private Sub HScroll1_Change() Shape1.Width = HScroll1.ValueEnd Sub
yHk(172)
uGefysLwmvufpJG 152
55/ Vertical Scroll Bar twGuf -Private Sub VScroll1_Change() Shape1.Height = VScroll1.ValueEnd Sub
56/ Option1 Button twGuf -Private Sub Option1_Click() If Option1.Value Then Shape1.Shape = 0 End IfEnd Sub
57/ Option2 Button twGuf -Private Sub Option2_Click() If Option2.Value Then Shape1.Shape = 2 End IfEnd Sub
58/ Option3 Button twGuf -Private Sub Option3_Click() If Option3.Value Then Shape1.Shape = 4 End IfEnd Sub
59/ Shape1-Fill Style ESifh Shape1-Shape udk,fpm;jyKeHygwfrsm;tm; Z,m;jzifhazmfjytyfygonf-
Shape1 - Fill Style0 Solid 4 Upward Diagonal1 Transparent 5 Downward Diagonal2 Horizontal Line 6 Cross3 Vertical Line 7 Diagonal Cross
153 Microsoft Visual Basic 6.0
Shape1 - Shape0 Rectangle 3 Circle1 Square 4 Rounded Rectangle2 Oval 5 Rounded Square
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
60/ yHk(173)yg Form wGif TextBox, Timer, wdkY
jzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;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 MeEnd
End Sub
64/ Form Load twGuf -Private Sub Form_Load()
Text1.Text = Time$
yHk(173)
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 EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
67/ yHk(174)yg Form wGif TextBox, wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGifvdktyfaomy½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")
yHk(174)
155 Microsoft Visual Basic 6.0
Text3.Text = Text2.TextEnd 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 EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
72/ yHk(175)yg Form wGif Label, TextBox, wdkYjzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
73/ Text1, Text2 TextBox Properties twGuf -Alignment - 2 - CenterFont - MS Sans Serif, 12, BoldText - Empty
74/ Command1 Command Button twGuf -Private Sub Command1_Click()
Unload MeEnd
End Sub
yHk(175)
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) + 32End 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 / 9End Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
77/ yHk(176)yg Form wGif Label, TextBox, wdkYjzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;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)
yHk(176)
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 IfEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
81/ yHk(177)yg Form xJwGif TextBox, ComboBox, Command
Button wdkYjzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemufCommand 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 = TrueEnd Sub
yHk(177)
uGefysLwmvufpJG 158
84/ Delete Command Button twGuf -Private Sub Command2_Click() n = Combo1.ListIndex If n <> -1 Then Combo1.RemoveItem n End IfEnd Sub
85/ Exit Command Button twGuf -Private Sub Command3_Click() Unload Me EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
86/ yHk(178)yg Form wGif OptionButton, wd k Y jzi f hwnfaqmufxm;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
yHk(178)
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 EndEnd 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
92/ yHk(179)yg Form wGif OptionButton, wdk Y jzif hwnfaqmufxm;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
yHk(179)
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 EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(180)
163 Microsoft Visual Basic 6.0
110/ yHk(180)yg Form wGif CheckBox, wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGifvdktyfaom 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 IfEnd Sub
112/ Exit Command Button twGuf -Private Sub Command2_Click() Unload Me EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
113/ yH k(181)yg Form wGif wdk Y jzif hwnfaqmufxm;NyD;Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
114/ Run Command Button twGuf -Private Sub Command1_Click()
Dim ret_date As Dateret_date = InputBox("Enter the Date of Joining", "Date of Joining")If ret_date > Date Then
yHk(181)
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 EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
116/ yHk(182)yg Form wGif Fans, Music System wdkYudk Menu Editor... jzifhvnf;aumif; TextBox, wdkYjzifhvnf;aumif;wnfaqmufxm;NyD;Properties rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGifvdktyfaomy½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
yHk(182)
165 Microsoft Visual Basic 6.0
119/ mnMusic \ Properties udk yHk(183)ygtwdkif; Index tm; 0 (Zero) xm;ay;&rnf/ xdkrSomy½dk*&rf Run í&ayrnf/
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 IfEnd Sub
121/ Exit Command Button twGuf -Private Sub Command2_Click() Unload Me EndEnd Sub
yHk(183)
uGefysLwmvufpJG 166
yHk(184)
122/ tqdkyg y½dk*&rfudk Run ygu yHk(184)ygtwdkif;jrifawGU&ayrnf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
123/ yHk(185)yg Form wGif File, Add, Delete, Exit wdkYudk Menu Editor...
jzifhvnf;aumif;? TextBox, wdkYjzifhvnf;aumif;wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGifvdktyfaom y½dk*&rfrsm;udk a&;om;&ayrnf/
124/ Menu Editor Dialog Box wGif Caption ESifh Name wdkYjznfhpGuf&eftcsufrsm;tm; Z,m;jzifhazmfjytyfygonf-
Caption Name
&File mnFile
&Add mnAdd
&Delete mnDelete
E&xit mnExitmnSep
yHk(185)
167 Microsoft Visual Basic 6.0
125/ mnSep udk Caption a&;&efrvdkyg/ Name wGifom 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 = FalseEnd 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 = TrueEnd Sub
129/ Delete Menu twGuf -Private Sub mnDelete_Click() Unload mnSep(LastItem) LastItem = LastItem - 1 If LastItem = 0 Then mnDelete.Enabled = False End IfEnd Sub
130/ Exit Menu twGuf -Private Sub mnExit_Click() Unload Me EndEnd Sub
uGefysLwmvufpJG 168
131/ mnSep Click twGuf -Private Sub mnSep_Click(Index As Integer) MsgBox "The selected item is " + Str(Index)End Sub
132/ tqdkyg y½dk*&rfudk Run ygu yHk(186)ygtwdkif;jrifawGU&ayrnf/
133/ Add Menu udka½G;ygu ITEM rsm;wdk;vmNyD; Delete Menu a½G;ygu ITEM
rsm; ysufoGm;onfudkawGU½Sd&ayrnf/- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
134/ yHk(187)yg Form wGif OptionButton, ,
wdkYjzifhvnf;aumif;wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/CommonDialog Control udk Toolbox twGif;odkYqJGwif&mwGif Toolbox EIwfcrf;om;vGwfaeaomae&mwpfckudk Mouse Pointer ñTefí Right Click ESdyfyg/ yHk(188)ygtwdkif;Short Cut Menu wpfckay:vmrnf/
yHk(186)
yHk(187)
169 Microsoft Visual Basic 6.0
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 udka½G;cs,fNyD; Apply Command Button udka½G;cs,fyg/ xdkYaemuf Close Command
Button udkxyfrHa½G;cs,f&rnf/
136/ xdktcg Toolbox wGif yHk(190)ygtwdkif; CommonDialog Control a&muf½Sdvmayrnf/
yHk(188)
yHk(189)
uGefysLwmvufpJG 170
137/ Option1-Option Properties wGif Index udk 0 (Zero) [kowfrSwf&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 IfEnd Sub
139/ Exit Command Button twGuf -Private Sub Command2_Click() Unload Me EndEnd 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"
yHk(190)
171 Microsoft Visual Basic 6.0
Option1(1).Caption = "Save" Option1(2).Caption = "Color" Command1.Caption = "Show Dlg" F = True End IfEnd Sub
141/ txufyg y½dk*&rfudk Run ygu atmufygtwdkif;jrifawGU&rnf/ yHk(191)/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(191)
yHk(192)
uGefysLwmvufpJG 172
142/ yHk(192)yg Form wGif File, Points, Line, Clear, Exit wdkYudk Menu Editor...
jzifhvnf;aumif;? vIyf½Sm;&rnfhtcsdefumvudk Timer wdkYjzifhvnf;aumif; wnfaqmuf
xm;NyD;? Timer1 Timer Properties wGif Interval-100 [k jyifqifjznfhpGufNyD;aemufPulldown Menu toD;oD;wGif vdktyfaom y½dk*&rfrsm;udk a&;om;&ayrnf/
143/ Menu Editor... \jyifqifrItm; Z,m;jzifhazmfjyxm;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 = 0End Sub
146/ Clear Pulldown Menu twGuf -Private Sub mnClear_Click() Points = 0 Form1.ClsEnd Sub
147/ Exit Pulldown Menu twGuf -Private Sub mnExit_Click() Unload Me EndEnd Sub
173 Microsoft Visual Basic 6.0
148/ Lines Pulldown Menu twGuf -Private Sub mnLines_Click()
Dim CounterFor Counter = 1 To 100 Step 1
Line -(Rnd * Form1.ScaleWidth, Rnd * Form1.ScaleHeight),RGB(0, 0, 0)
NextEnd Sub
149/ Points Pulldown Menu twGuf -Private Sub mnPoints_Click()
Points = 1End Sub
150/ Timer1 Timer tcsdefumv twGuf -Private Sub Timer1_Timer()
Dim R, G, BDim X, YDim CounterIf Points = 1 Then
For Counter = 1 To 100 Step 1R = Rnd * 255G = Rnd * 255B = Rnd * 255X = Rnd * Form1.ScaleWidthY = Rnd * Form1.ScaleHeightForm1.PSet (X, Y), RGB(R, G, B)
NextEnd If
End Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
uGefysLwmvufpJG 174
151/ yHk(192)yg Form wGif Command Button wpfckwnf;jzifhomwnfaqmufxm;NyD;vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
152/ Form udk Click vkyfygujzpfay:vm&eftwGuf -Private Sub Form_Click()
Dim iScaleHeight = 8For i = 0 To 5
DrawStyle = iLine (0, i + 1)-(ScaleWidth, i + 1)
NextEnd Sub
153/ Exit Command Button twGuf -Private Sub Command1_Click() Unload Me EndEnd Sub
154/ tqdkyg y½dk*&rfudk Run NyD; Form xJudk Mouse Left Click vkyfygu yHk(194)yg twdkif;jrifawGU&rnf/
yHk(193)
175 Microsoft Visual Basic 6.0
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
155/ yHk(195)yg Form wGif Command Button wpfckwnf;jzifhomwnfaqmufxm;NyD; vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
156/ Form udk Click vkyfygujzpfay:vm&eftwGuf -Private Sub Form_Click()
Dim CX, CY, RadiusScaleMode = 3CX = ScaleWidth / 2CY = ScaleHeight / 2If CX > CY Then Limit = CY Else Limit = CX
yHk(194)
yHk(195)
uGefysLwmvufpJG 176
For Radius = 0 To LimitCircle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
NextEnd Sub
157/ Exit Command Button twGuf -Private Sub Command1_Click() Unload Me EndEnd Sub
158/ tqdkyg y½dk*&rfudk Run NyD; Form xJudk Mouse Left Click vkyfygu yHk(196)yg twdkif;jrifawGU&rnf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(196)
177 Microsoft Visual Basic 6.0
159/ yHk(197)yg TextBox, wdkYjzifhvnf;aumif;wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGifvdktyfaomy½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 = FreeFileOpen "C:\Setupxlg.txt" For Input As filenumText1.Text = Input(LOF(filenum), filenum)Close filenum
End Sub
162/ Exit Command Button twGuf -Private Sub Command1_Click()
Unload MeEnd
End Sub
yHk(197)
uGefysLwmvufpJG 178
163/ tqdkygy½dk*&rfudk Run NyD; Form xJudk Mouse Left Click vkyfygu yHk(198)ygtwdkif;jrifawGU&rnf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
163/ yHk(199)yg Form yHkpHwGif Label, TextBox, Frame,
Combo Box, CheckBox, wdkYjzifhvnf;aumif; wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGifvdktyfaom y½dk*&rfrsm;udk a&;om;&ayrnf/
yHk(198)
yHk(199)
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 frameDim 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 checkedIf (Check1.Value = 1) Then
Label2.FontUnderline = TrueElse
Label2.FontUnderline = FalseEnd If
End Sub
169/ Check2 twGuf -Private Sub Check2_Click()
'Executes when check box Strike Through is checkedIf (Check2.Value = 1) Then
Label2.FontStrikethru = TrueElse
Label2.FontStrikethru = FalseEnd If
End Sub
uGefysLwmvufpJG 180
170/ Combol1 twGuf -Private Sub Combo1_LostFocus()
'Executes after you selected font nameLabel2.FontName = Combo1.Text
End Sub
171/ Combol2 twGuf -Private Sub Combo2_Change()
'Executes after you selected font styleIf Combo2.Text = "Italic " Or Combo2.Text = "BoldItalic " Then
Label2.FontItalic = TrueLabel2.FontBold = False
ElseLabel2.FontItalic = FalseLabel2.FontBold = True
End IfEnd Sub
172/ Combol3 twGuf -Private Sub Combo3_Change()
'Executes after you selected font sizeLabel2.FontSize = Val(Combo3.Text)
End Sub
173/ Font Command Button twGuf -Private Sub Command1_Click()
'Executes when font button is clickedForm1.Height = h'Initial form height after you click on font buttonFrame1.Visible = True
End Sub
174/ Preview Command Button twGuf -Private Sub Command2_Click()
'Executes after you selected Ok buttonText1.FontName = Label2.FontNameText1.FontSize = Label2.FontSizeIf Label2.FontItalic = True Then
181 Microsoft Visual Basic 6.0
Text1.FontBold = FalseText1.FontItalic = True
ElseText1.FontBold = TrueText1.FontItalic = False
End IfIf (Check1.Value = 1) Then
Text1.FontUnderline = TrueElse
Text1.FontUnderline = FalseEnd IfIf (Check2.Value = 1) Then
Text1.FontStrikethru = TrueElse
Text1.FontStrikethru = FalseEnd If
End Sub
175/ Exit Command Button twGuf -Private Sub Command3_Click()
Unload MeEnd
End Sub
176/ Form Load twGuf -Private Sub Form_Load()
h = Form1.Heightf = Frame1.HeightFrame1.Visible = FalseForm1.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.TextEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
uGefysLwmvufpJG 182
yHk(200)
178/ yHk(200)yg Form yHkpHwGif Label, TextBox, wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;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 EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
183 Microsoft Visual Basic 6.0
yHk(201)
181/ yHk(201)yg Form yHkpHwGif DirListBox, FileListBox, Drive
ListBox, Label, Image, wdkYjzifhwnfaqmufxm;NyD;
Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGifvdktyfaomy½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.PathEnd Sub
186/ File a½G;&eftwGuf -Private Sub File1_Click() Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName) Label1.Caption = Dir1.Path & "\" & File1.FileNameEnd Sub
187/ Exit - Command Button twGuf -Private Sub Command2_Click() Unload Me EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
185 Microsoft Visual Basic 6.0
188/ yHk(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.ClearEnd Sub
193/ Exit Command Button twGuf -Private Sub Command4_Click() Unload Me EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(202)
uGefysLwmvufpJG 186
194/ yHk(202)yg FormyHkpHwGif , Command Button wdkYjzifhwnfaqmufxm;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 = 10For Column = 1 To 10
For Row = 1 To 10.Column = Column.Row = Row
Next RowNext Column
End WithEnd Sub
yHk(203)
187 Microsoft Visual Basic 6.0
196/ Exit Command Button twGuf -Private Sub Command4_Click() Unload Me EndEnd Sub
197/ txufygy½dk*&rfudk Run ygu yHk(204)ygtwdkif;jrifawGU&ayrnf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(204)
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 wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGifvdktyfaom 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 IfEnd 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.TextEnd Sub
201/ Exit Command Button twGuf -Private Sub Command2_Click() Unload Me EndEnd Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
191 Microsoft Visual Basic 6.0
202/ yHk(207)yg Form yHkpHwGif , Command Button wdkYjzifhwnfaqmufxm;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, yFor x = 1 To 12 Step 1
MSFlexGrid1.Row = xFor y = 1 To 12 Step 1
MSFlexGrid1.Col = yMSFlexGrid1.Text = x + y
NextNext
End Sub
yHk(207)
uGefysLwmvufpJG 192
205/ Subtract Command Button twGuf -Private Sub Command2_Click()
Form1.Caption = "Subtraction Program"Dim x, yFor x = 1 To 12 Step 1
MSFlexGrid1.Row = xFor y = 1 To 12 Step 1
MSFlexGrid1.Col = yMSFlexGrid1.Text = x - y
NextNext
End Sub
206/ Division Command Button twGuf -Private Sub Command3_Click()
Form1.Caption = "Division Program"Dim x, yFor x = 1 To 12 Step 1
MSFlexGrid1.Row = xFor y = 1 To 12 Step 1
MSFlexGrid1.Col = yMSFlexGrid1.Text = x / y
NextNext
End Sub
207/ Multiplication Command Button twGuf -Private Sub Command4_Click()
Form1.Caption = "Multiplication Program"Dim x, yFor x = 1 To 12 Step 1
MSFlexGrid1.Row = xFor y = 1 To 12 Step 1
MSFlexGrid1.Col = yMSFlexGrid1.Text = x * y
193 Microsoft Visual Basic 6.0
NextNext
End Sub
208/ Grid Line Width Command Button twGuf -Private Sub Command5_Click()
If MSFlexGrid1.GridLineWidth < 4 ThenMSFlexGrid1.GridLineWidth = MSFlexGrid1.GridLineWidth + 1
ElseMSFlexGrid1.GridLineWidth = 1
End IfEnd Sub
209/ Exit Command Button twGuf -Private Sub Command6_Click()
Unload MeEnd
End Sub
210/ Form Load twGuf -Private Sub Form_Load()
Dim a As IntegerMSFlexGrid1.Row = 0For a = 1 To 12
MSFlexGrid1.Col = aMSFlexGrid1.Text = Str(a)
NextMSFlexGrid1.Col = 0For a = 1 To 12
MSFlexGrid1.Row = aMSFlexGrid1.Text = Str(a)
NextEnd Sub
uGefysLwmvufpJG 194
211/ yHk(207)yg Form yHkpH Program udk Run yguatmufygtwdkif;jrifawGU&rnf/yHk(208)/
212/ Add Command Button udka½G;cs,fygu yHk(209)ygtwdkif;jrifawGU&rnf/
yHk(208)
yHk(209)
195 Microsoft Visual Basic 6.0
213/ Subtract Command Button udka½G;cs,fygu yHk(210)ygtwdkif;jrifawGU&rnf/
214/ Division Command Button udka½G;cs,fygu yHk(211)ygtwdkif;jrifawGU&rnf/
yHk(210)
yHk(211)
uGefysLwmvufpJG 196
215/ Multiplication Command Button udka½G;cs,fygu yHk(212)ygtwdkif;jrifawGU&rnf/
216/ Grid Line Width Command Button udka½G;cs,fyguyHk(213)ygtwdkif;jrifawGU&rnf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(212)
yHk(213)
197 Microsoft Visual Basic 6.0
217/ yHk(214)yg Form yHkpHwGif , Label, Command But-
ton wdkY jzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command
Button toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
218/ Exit Command Button twGuf -Private Sub Command1_Click() Unload Me EndEnd Sub
219/ Form Load twGuf -Private Sub Form_Load() MSFlexGrid1.Cols = 6 MSFlexGrid1.Rows = 7End Sub
220/ Grid Line Change &eftwGuf -Private Sub MSFlexGrid1_RowColChange() Msg = "Active Cell: " & Chr(64 + MSFlexGrid1.Col) Msg = Msg & MSFlexGrid1.Row Label1.Caption = MsgEnd Sub
221/ tqdkyg y½dk*&rfudk Run NyD; rdrdtvdk½Sd&m Row (or) Column wdkYudka½G;cs,fyguGrid Line Cell tuGuf½Sd Cell Reference udk yHk(215)ygtwdkif;azmfjyvdrfhrnf/
yHk(214)
uGefysLwmvufpJG 198
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
222/ yHk(216)yg Form yHkpHwGif , Command Button wdkYjzifhwnfaqmufxm;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
yHk(215)
yHk(216)
199 Microsoft Visual Basic 6.0
225/ Add Text Command Button twGuf -Private Sub Command1_Click()
RichTextBox2.Text = RichTextBox2.Text & RichTextBox1.SelTextEnd Sub
226/ Exit Command Button twGuf -Private Sub Command2_Click()
Unload MeEnd
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/ yHk(217)yg b,fbufwGif½Sdaeaompmom;tm; Selected Text vkyfNyD;? yHk(218)?Add Text Command Button udka½G;cs,fygu yHk(219)ygtwdkif;jzpfay:vmrnf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(218)
yHk(219)
201 Microsoft Visual Basic 6.0
230/ yHk(220)yg Form yHkpHwGif , , Com-
mand Button wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemufCommand 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.ShowOpenIf CommonDialog1.FilterIndex = 1 Then
RichTextBox1.LoadFile CommonDialog1.FileName, rtfTextElse
RichTextBox1.LoadFile CommonDialog1.FileName, rtfRTFEnd IfMe.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.ShowSaveIf CommonDialog1.FilterIndex = 1 Then
RichTextBox1.SaveFile CommonDialog1.FileName, rtfTextElse
RichTextBox1.SaveFile CommonDialog1.FileName, rtfRTFEnd If
End Sub
yHk(220)
uGefysLwmvufpJG 202
233/ Fonts Command Button twGuf -Private Sub Command3_Click()
CommonDialog1.Flags = cdlCFEffects + cdlCFBothCommonDialog1.ShowFontWith RichTextBox1
.SelBold = CommonDialog1.FontBold
.SelFontName = CommonDialog1.Name
.SelFontSize = CommonDialog1.FontSize
.SelItalic = CommonDialog1.FontItalic
.SelStrikeThru = CommonDialog1.FontStrikethru
.SelUnderline = CommonDialog1.FontUnderline
.SelColor = CommonDialog1.ColorEnd With
End Sub
234/ Exit Command Button twGuf -Private Sub Command4_Click() Unload Me EndEnd Sub
235/ Form tus,ftusOf;jyKvkyf&eftwGuf -Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then Exit SubRichTextBox1.Height = Me.Height - 1260RichTextBox1.Width = Me.Width - 285Command1.Top = Me.Height - 915Command2.Top = Me.Height - 915Command3.Top = Me.Height - 915Command4.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/ tqdkyg y½dk*&rfudk Run yguyHk(221)ygtwdkif;jrifawGU&rnf/
238/ Open File Command Button udka½G;cs,fygu yHk(222)ygtwdkif;jrifawGU&rnf/
yHk(221)
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 trsKd;tpm; (2)ckxJrS BuKduf&mzdkiftrsKd;tpm;udka½G;cs,fí Open Command Button
udka½G;cs,fygu a½G;cs,fjcif;cH&aom *.txt (or) *.rtf File rsm;yGifhvmayrnf/ 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
yHk(223)
205 Microsoft Visual Basic 6.0
241/ yHk(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 ESdyfyg/ xdkYaemufProperties udka½G;cs,fygu yHk(225)ygtwdkif; Property Pages Dialog Box ay:vmrnf/
yHk(224)
uGefysLwmvufpJG 206
245/ Property Pages Dialog Box xJ½Sd General, Buttons, Picture Tab
Command Button (3)ckxJrS Buttons Tab Command Button udka½G;cs,fyg/ xdkYaemuf4if;xJwGifyg0ifaom tcsuftvufrsm;tm;atmufazmfjyygZ,m;twdkif; jyifqifjznfhpGuf&ef -
Index Caption Key Tag1 Cut Button1 12 Copy Button2 23 Paste Button3 3
246/ Toolbar xJ½Sd Button rsm;twGuf -Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.KeyCase "Button2":
Clipboard.Clear
yHk(225)
207 Microsoft Visual Basic 6.0
Clipboard.SetText Text1.SelTextCase "Button1":
Clipboard.ClearClipboard.SetText Text1.SelTextText1.Text = " "
Case "Button3":Text1.SelText = Clipboard.GetText()
End SelectEnd Sub
247/ Exit Command Button twGuf -Private Sub Command1_Click() Unload Me EndEnd Sub
248/ tqdkygy½dk*&rfudk Run NyD; Text Box xJwGifpmrsm;½dkufESdyfí rdrdtvdk½Sd&mpmrsm;udk Selected Text (or) Drag jyKvkyfum ul;jcif;? jzwfjcif;? uyfjcif;wdkYudkaqmif½GufEdkifygonf/ y½dk*&rfxJrS xGufvdkygu Exit Command Button udka½G;cs,f&efjzpfygonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
249/ yHk(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/
yHk(226)
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 Tag1 Subject One Sub1 12 Subject Two Sub2 23 Subject Three Sub3 34 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 IntegerDim c As Stringi = i + 1c = 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 Integeri = 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 IntegerDim c As Stringi = i + 1If StatusBar1.Panels.Count = 16 Then
MsgBox "You can add only 16 Panels in a Status Bar"Exit Sub
End Ifc = InputBox("Enter Panel Title")StatusBar1.Panels.Add i, , cStatusBar1.Panels(i).AutoSize = sbrSpring
End SubPrivate 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 Integeri = 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 MeEnd
End Sub
uGefysLwmvufpJG 210
258/ Status Bar Panel Click twGuf -Private Sub StatusBar1_PanelClick(ByVal Panel As MSComctlLib.Panel) MsgBox "You have Clicked" & Panel.TextEnd Sub
259/ Tool Bar Button Click twGuf -Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) MsgBox "You have Clicked" & Button.CaptionEnd Sub
260/ txufygy½dk*&rfudk Run NyD; Add Button udka½G;cs,fygu Enter Button
Title \ acgif;pOfatmuf List Box wGif rdrdtvdk½Sd&mpmom;udk½dkufESdyfNyD; OK udka½G;cs,fyg/ yHk(227)? yHk(228)/
yHk(227)
yHk(228)
211 Microsoft Visual Basic 6.0
261/ Delete Button udka½G;cs,fygu Enter Button No. to Delete \acgif;pOfatmuf List Box wGif rdrdz,f½Sm;vdkonfhtrSwfpOfudk½dkufESdyfNyD; OK udka½G;cs,fyg/ 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)/
yHk(229)
yHk(230)
uGefysLwmvufpJG 212
263/ DeletePanel udka½G;cs,fygu Enter Button No. to Delete \acgif;pOfatmuf List Box wGif rdrdz,f½Sm;vdkonfhtrSwfpOfudk½dkufESdyfNyD; OK udka½G;cs,fyg/ yHk(233)?yHk(234)/
yHk(231)
yHk(232)
213 Microsoft Visual Basic 6.0
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(233)
yHk(234)
uGefysLwmvufpJG 214
264/ yHk(235)yg Form yHkpHwGif ProgressBar,, Command Button wdkYjzifhwnfaqmufxm;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 IntegerFor n1 = 1 To 30000
Form1.Caption = "Processing Step " & Trim$(CStr(n1)) & " of 30000"ProgressBar1 = n1
Next n1End Sub
267/ Exit Command Button twGuf -Private Sub Command2_Click()
Unload MeEnd
End Sub- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(235)
215 Microsoft Visual Basic 6.0
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 TextBoxSlider1.Left = Text1.Left 'Align the Slider to the TextBox'Match the width of the Slider to the TextBoxSlider1.Max = Text1.Width'Place the Slider a little below the TextBoxSlider1.Top = Text1.Top + Text1.Height + 50'Set tickfrequency to a fraction of the Max valueSlider1.TickFrequency = Slider1.Max * 0.1'SetLargeChange and SmallChange value to a fraction of MaxSlider1.LargeChange = Slider1.Max * 0.1Slider1.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 valueIf Slider1.Value > Slider1.Max / 3 Then
Text1.Width = Slider1.ValueEnd If
End Sub
yHk(236)
uGefysLwmvufpJG 216
271/ Exit Command Button twGuf -Private Sub Command2_Click()
Unload MeEnd
End Sub
272/ tqdkyg y½dk*&rfudk Run yguyHk(237)ygtwdkif;jrifawGU&rnfjzpfNyD; Slider
\twdk;^ tavsmhajymif;Munfhygu Text Box tus,f̂ tusOf;jzpfoGm;onfudk jrifawGU&ayrnf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
273/ yHk(238)yg Form yHkpHwGif ImageList, PictureBox, Com-
mand Button wdkY jzifh wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemufCommand Button toD;oD;wGif vdktyfaomy½dk*&rfrsm;udk a&;om;&ayrnf/
yHk(237)
yHk(238)
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 ESdyfyg/ xdkYaemufProperties udka½G;cs,fygu yHk(239)ygtwdkif; Property Pages Dialog Box ay:vmrnf/
275/ Property Pages Dialog Box xJ½Sd General, Images, Color Tab
Command Button (3)ckxJrS Images Tab Command Button udka½G;cs,fyg/ xdkYaemuf4if;xJwGifyg0ifaom Insert Picture... Command Button udka½G;cs,fyg/ xdktcg rdrdtvdk½Sdonfh *.bmp File (odkYr[kwf) *.ico File ½Sdonfh vrf;aMumif;rsm;udk½SmazGa½G;cs,fízdkifrsm;tm; qJGwif&rnf/ yHk(240)/
yHk(239)
uGefysLwmvufpJG 218
276/ yHk(240)wGif Open udka½G;cs,fyguyHk(239)wGifazmfjyxm;onfhtwdkif; Club.
bmp File a&mufoGm;vdrfhrnf/ txufyg y½dk*&rfudk Run ygu rdrdtvdk½Sdonfh Image
qJGwifvdkygu &½Sdrnfjzpfygonf/ yHk(241)/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(240)
yHk(241)
219 Microsoft Visual Basic 6.0
277/ yHk(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 ESdyfyg/ xdkYaemufProperties udka½G;cs,fygu yHk(243)ygtwdkif; Property Pages Dialog Box ay:vmrnf/
yHk(242)
yHk(243)
uGefysLwmvufpJG 220
279/ Property Pages Dialog Box xJ½Sd General, Tabs, Font, Picture
Command Button (4)ckxJrS Tabs Tab Command Button udka½G;cs,fyg/ xdkYaemuf4if;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" ThenText1.Text = "Sales Department"Text2.Text = "Purchase Department"Text3.Text = "Admin Department"
ElseIf TabStrip1.SelectedItem.Tag = "Two" ThenText1.Text = "Keyboard"Text2.Text = "Monitor"Text3.Text = "Hard Disk"
ElseIf TabStrip1.SelectedItem.Tag = "Three" ThenText1.Text = "London"Text2.Text = "New York"Text3.Text = "Singapore"
End IfEnd Sub
281/ Exit Command Button twGuf -Private Sub Command1_Click() Unload Me EndEnd Sub
282/ tqdkyg y½dk*&rfudk Run yguyHk(244)ygtwdkif;jrifawGU&rnf/
221 Microsoft Visual Basic 6.0
283/ yHk(244)wGif Tab Command Button wpfckjzpfaom Department udka½G;cs,fygu yHk(245)ygtwdkif; Department ESifhqdkifaomXmersm;udk azmfjyrnfjzpfonf/
284/ yHk(245)wGif Tab Command Button wpfckjzpfaom Items udka½G;cs,fyguyHk(246) ygtwdkif; Item ESifhqdkifaomudpö&yfrsm;udk azmfjyrnfjzpfonf/
yHk(244)
yHk(245)
uGefysLwmvufpJG 222
285/ yHk(246)wGif Tab Command Button wpfckjzpfaom Branches udka½G;cs,fygu yHk(247)ygtwdkif; Branches ESifhqdkifaomudpö&yfrsm;udk azmfjyrnfjzpfonf/
286/ þy½dk*&rfxJrS xGufvdkygu Command Button wpfckjzpfaom Exit udka½G;cs,f&efjzpf ygonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(246)
yHk(247)
223 Microsoft Visual Basic 6.0
Microsoft Calendar Control (Form twGif;jyu©'defxnfhjcif;)287/ yHk(248)yg Form yHkpHwGif Calendar, Command Button wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
twGufvdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
288/ Exit Command Button twGuf -Private Sub Command1_Click() Unload Me EndEnd Sub
289/ tqdkyg y½dk*&rfudk Run ygu ,aeYwGif½Sdaernfh &uf? v? ckESpf jyu©'defudkazmfjyrnfjzpfonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(248)
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/
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 EndEnd Sub
293/ tqdkygy½dk*&rfudk Run ygu yHk(250)ygtwdkif;jrifawGU&rnf/
yHk(249)
225 Microsoft Visual Basic 6.0
294/ txufygyHk(250)wGif Call Indirect Command Button Sub udka½G;cs,fyguyHk(251)ygtwdkif;azmfjyrnf/
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 zdkifygwdkuf½dkufyGifhvmNyD;tvdk½Sd&mjyKvkyfEdkifayrnf/ 4if;y½dk*&rfrSxGufvdkygu Exit Command Button tm;a½G;cs,f&efjzpfonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(250)
yHk(251)
uGefysLwmvufpJG 226
jr§m;rsm;udkywfjcmvnfvSnfhonfhy½dk*&rfudka&;jcif;296/ yHk(248)yg Form yHkpHwGif Image, Command Button wdkYjzifhwnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button
rsm;twGufvdktyfaom y½dk*&rfrsm;udka&;om;&ayrnf/
297/ Form1 - Form Properties wGif -WindowState - 2 - Maximized
298/ General wGif -Private Sub rotate() For t = 0 To 100 NextEnd 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 = 0Image1.Top = 0Image1.Visible = TrueImage2.Visible = FalseImage3.Visible = False
yHk(252)
227 Microsoft Visual Basic 6.0
Image4.Visible = Falsei = Image1.Left
j = Image1.TopFor i = 0 To 11500 Step 1
rotateImage1.Move Image1.Left + 1, Image1.Top
Next iImage1.Left = 0Image1.Top = 0''''''''''''''Image2.Left = 11500Image2.Top = 0Image1.Visible = FalseImage2.Visible = TrueImage3.Visible = FalseImage4.Visible = FalseFor j = 0 To 8300 Step 1
rotateImage2.Move Image2.Left, Image2.Top + 1
Next jImage2.Left = 11500Image2.Top = 0''''''''''''''Image3.Left = 11500Image3.Top = 8300Image1.Visible = FalseImage2.Visible = FalseImage3.Visible = TrueImage4.Visible = FalseFor j = 11500 To 0 Step -1
rotateImage3.Move Image3.Left - 1, Image3.Top
Next jImage3.Left = 11500Image3.Top = 8300
uGefysLwmvufpJG 228
''''''''''''''Image4.Left = 0Image4.Top = 8300Image1.Visible = FalseImage2.Visible = FalseImage3.Visible = FalseImage4.Visible = TrueFor j = 8300 To 0 Step -1
rotateImage4.Move Image4.Left, Image4.Top - 1
Next jImage4.Left = 0Image4.Top = 8300Print: Print: Print " ", k: Beep
Next kImage1.Left = 0Image1.Top = 0Image1.Visible = TrueImage2.Visible = FalseImage3.Visible = FalseImage4.Visible = False
End Sub
300/ Exit Command Button twGuf -Private Sub Command2_Click()
Unload MeEnd
End Sub
301/ tqdkyg y½dk*&rfudk Run ygu jr§m;wpfpif;onf vufsm&pf(10)Budrfywfaeonfudk 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 yHkpH(2)cktm; zefwD;wnfaqmufxm;&rnf/ yHk(253)? yHk(254)/
2/ yHk(253)yg Form yHkpHwGif rsm;jzifhzefwD;xm;NyD; Command
Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
3/ Open File Command Button twGuf-Private Sub Command1_Click() Form1.Hide Form2.ShowEnd Sub
yHk(253)
yHk(254)
uGefysLwmvufpJG 230
4/ Exit Command Button twGuf-Private Sub Command2_Click() Unload Me EndEnd 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] fromexam01 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 = vbDefaultEnd Sub
18/ Record Position od&eftwGuf -Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.Event
ReasonEnum, ByVal pError As ADODB.Error, adStatus AsADODB.EventStatusEnum, ByVal pRecordset AsADODB.Recordset)
Adodc1.Caption = "Record: " & CStr(Adodc1.Recordset.AbsolutePosition)
End Sub
19/ Add Command Button twGuf -Private Sub Command1_Click()
Adodc1.Recordset.AddNewEnd Sub
20/ Update Command Button twGuf -Private Sub Command2_Click()
Adodc1.Recordset.UpdateBatch adAffectAllEnd Sub
21/ Delete Command Button twGuf -Private Sub Command3_Click()
With Adodc1.Recordset.Delete.MoveNextIf .EOF Then .MoveLast
End WithEnd Sub
uGefysLwmvufpJG 234
22/ Refresh Command Button twGuf -Private Sub Command4_Click()
Adodc1.RefreshEnd Sub
23/ Close Command Button twGuf -Private Sub Command5_Click()
Form2.HideForm1.Show
End Sub
24/ tqdkyg y½dk*&rfudk Run ygu yHk(255)ygtwdkif;jrifawGU&rnfjzpfonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(255)
235 Microsoft Visual Basic 6.0
Access 2002 ½Sd Database File wpfckxJrS Table File ESpfcktm; Updating jyKvkyfjcif;25/ atmufyg Form yHkpH(3)cktm; zefwD;wnfaqmufxm;&rnf/ yHk(256)? yHk(257)?yHk(258)/
yHk(256)
yHk(257)
uGefysLwmvufpJG 236
26/ yHk(256)yg Form yHkpHwGif rsm;jzifhzefwD;xm;NyD; 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.ShowEnd Sub
28/ (9)wef;(c)zdkif Command Button twGuf-Private Sub Command1_Click() Form1.Hide Form3.ShowEnd Sub
29/ Exit Command Button twGuf-Private Sub Command2_Click() Unload Me EndEnd Sub
30/ xdkYaemuf Form2, Form3 yHkpHtm;zefwD;wnfaqmufxm;&rnf/ yHk(257)?yHk(258)/ 4if;wGif , , , ,
yHk(258)
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] fromexam01 order by [Roll Number][Form2 twGuf]
( Z) RecordSource - select [Roll Number], Name,Myanmar, English, Maths,Total,Result,[Amount of Fail] fromexam02 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 = vbDefaultEnd Sub
43/ Record Position od&eftwGuf -Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.Event
ReasonEnum, ByVal pError As ADODB.Error, adStatus AsADODB.EventStatusEnum, ByVal pRecordset AsADODB.Recordset)
Adodc1.Caption = "Record: " & CStr(Adodc1.Recordset.AbsolutePosition)
End Sub
44/ (3)bmomaygif;jcif; Command Button twGuf -Private Sub Command1_Click()
Adodc1.Recordset.MoveFirstDo 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 ThenAdodc1.Recordset("Result") = "Fail"
ElseAdodc1.Recordset("Result") = "Pass"
End IfIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset
("English") < 40 And Adodc1.Recordset("Maths") < 40 ThenAdodc1.Recordset("Amount of Fail") = "3"
ElseIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset("English") < 40 And Adodc1.Recordset("Maths") >= 40 ThenAdodc1.Recordset("Amount of Fail") = "2"
ElseIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset("English") >= 40 And Adodc1.Recordset("Maths") < 40 ThenAdodc1.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 ThenAdodc1.Recordset("Amount of Fail") = "2"
ElseIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset("English") >= 40 And Adodc1.Recordset("Maths") >= 40Then
Adodc1.Recordset("Amount of Fail") = "1"ElseIf Adodc1.Recordset("Myanmar") >= 40 And Adodc1.Recordset
("English") < 40 And Adodc1.Recordset("Maths") >= 40 ThenAdodc1.Recordset("Amount of Fail") = "1"
ElseIf Adodc1.Recordset("Myanmar") >= 40 And Adodc1.Recordset("English") >= 40 And Adodc1.Recordset("Maths") < 40 ThenAdodc1.Recordset("Amount of Fail") = "1"
ElseAdodc1.Recordset("Amount of Fail") = Null
End IfAdodc1.Recordset.UpdateAdodc1.Recordset.MoveNext
LoopAdodc1.Recordset.MoveFirst
End Sub
45/ rlvae&modkYjyefoGm;jcif; Command Button twGuf - [Form2 twGuf]Private Sub Command2_Click()
Form2.HideForm1.Show
End Sub
46/ rlvae&modkYjyefoGm;jcif; Command Button twGuf - [Form3 twGuf]Private Sub Command2_Click()
Form3.HideForm1.Show
End Sub - - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
uGefysLwmvufpJG 242
Access 2002 ½Sd Database File wpfckxJrS Table File rsm;tm; Form wpfckjzifhzGifhjcif;47/ atmufyg Form yHkpHtm; zefwD;wnfaqmufxm;&rnf/ yHk(259)/
48/ yHk(259)yg Form yHkpHwGif , , 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] fromexam01 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=;
yHk(259)
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] fromexam02 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] fromexam03 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.EventStatusEnum, 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 = a1a1.Left = 2880a1.Top = 4440a2.Left = 2640a2.Top = 5760a3.Left = 5160a3.Top = 5760Form1.Height = 5985Form1.Caption = "Standard 9th, Section (A)"
End Sub
57/ File Two Command Button twGuf -Private Sub Command2_Click()
Set DataGrid1.DataSource = a2a1.Left = 120a1.Top = 5760a2.Left = 2880a2.Top = 4440a3.Left = 5160a3.Top = 5760
245 Microsoft Visual Basic 6.0
Form1.Height = 5985Form1.Caption = "Standard 9th, Section (B)"
End Sub
58/ File Three Command Button twGuf -Private Sub Command3_Click()
Set DataGrid1.DataSource = a3a1.Left = 120a1.Top = 5760a2.Left = 2640a2.Top = 5760a3.Left = 2880a3.Top = 4440Form1.Height = 5985Form1.Caption = "Standard 9th, Section (C)"
End Sub
59/ Exit Command Button twGuf -Private Sub Command4_Click()
Unload MeEnd
End Sub
60/ Form Load twGuf -Private Sub Form_Load()
Form1.Height = 6975End Sub
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
uGefysLwmvufpJG 246
Access 2002 ½Sd Database File trsm;pkxJrS Table File trsm;pktm; Form wpfckjzifhzGifhjcif;61/ atmufyg Form yHkpHtm; zefwD;wnfaqmufxm;&rnf/ yHk(260)/
62/ yHk(260)yg Form yHkpHwGif , , 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 fromTest1 order by [IdentificationNumber]
64/ a2 - Adodc Properties twGuf -(u) (Name) - a2( c) Align - 0 - vbAlignNone( *) BOFAction - 0 - adDoMoveFirst(C) ConnectingString - provider=msdasql;dsn=exam02;
uid=;pwd=;
yHk(260)
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] fromexam02 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] fromexam03 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.EventStatusEnum, 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.EventStatusEnum, 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 = a1a1.Left = 2880a1.Top = 4440a2.Left = 2640a2.Top = 5760a3.Left = 5160a3.Top = 5760Form1.Height = 5985Form1.Caption = "Economic File (Table File) from Test1.mdb"
End Sub
71/ File Two Command Button twGuf -Private Sub Command2_Click()
Set DataGrid1.DataSource = a2a1.Left = 120a1.Top = 5760a2.Left = 2880a2.Top = 4440a3.Left = 5160a3.Top = 5760
249 Microsoft Visual Basic 6.0
Form1.Height = 5985Form1.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 = a3a1.Left = 120a1.Top = 5760a2.Left = 2640a2.Top = 5760a3.Left = 2880a3.Top = 4440Form1.Height = 5985Form1.Caption = "Standard 9th, Section (C) (Table File) from
exam01.mdb"End Sub
73/ Exit Command Button twGuf -Private Sub Command4_Click()
Unload MeEnd
End Sub
74/ Form Load twGuf -Private Sub Form_Load()
Form1.Height = 6975End Sub
75/ tqdkyg y½dk*&rfudk Run ygu yHk(261)? (262)? (263)ygtwdkif;jrifawGU&rnf/
uGefysLwmvufpJG 250
yHk(261)
yHk(262)
251 Microsoft Visual Basic 6.0
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(263)
uGefysLwmvufpJG 252
Access 2002 ½Sd Database File twGif;rS Table File rsm;tm; Form wpfckjzifhAppend jyKvkyfjcif;76/ atmufyg Form yHkpHtm; zefwD;wnfaqmufxm;&rnf/ yHk(264)/
77/ yHk(264)yg Form yHkpHwGif , , 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 fromTest1 order by [IdentificationNumber]
79/ a2 - Adodc Properties twGuf -(u) (Name) - a2( c) Align - 0 - vbAlignNone( *) BOFAction - 0 - adDoMoveFirst(C) ConnectingString - provider=msdasql;dsn=exam02;
uid=;pwd=;
yHk(264)
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] fromTest1 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.EventStatusEnum, 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 = a1a1.Recordset.MoveFirstDo While a1.Recordset.EOF = False
a2.Recordset.AddNewz01 = a1.Recordset("Identification Number")z02 = a1.Recordset("Rank")z03 = a1.Recordset("Name")z04 = a1.Recordset("Department")a2.Recordset("Identification Number") = z01a2.Recordset("Rank") = z02a2.Recordset("Name") = z03a2.Recordset("Department") = z04a1.Recordset.MoveNexta2.Recordset.Update
Loopa1.Recordset.MoveFirsta1.Refresha2.Recordset.MoveFirsta2.RefreshForm1.Caption = "To add Test1 Table File from Exam02 Database File"
End Sub
85/ Exit Command Button twGuf -Private Sub Command2_Click()
Unload MeEnd
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)/
87/ yHk(265)yg Form yHkpHwGif , , , ,
rsm;jzifh zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;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 fromTest1 order by [IdentificationNumber]
89/ DataGrid1 - DataGrid Properties twGuf -(u) (Name) - DataGrid1( c) Align - 0 - vbAlignNone( *) AllowAddNew - True(C) AllowArrows - True( i) AllowDelete - True
yHk(265)
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.EventStatusEnum, 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 = a1z1 = Text1a1.Recordset.MoveFirstDo While a1.Recordset.EOF = False
If a1.Recordset("Identification Number") = z1 ThenCls:PrintPrint a1.Recordset("Identification Number"), a1.Recordset
("Rank"),a1.Recordset("Name"), a1.Recordset("Department")
Exit DoElse
ClsPrintPrint "Not Fount"
End Ifa1.Recordset.MoveNext
LoopEnd Sub
92/ Exit Command Button twGuf -Private Sub Command2_Click()
Unload MeEnd
End Sub
257 Microsoft Visual Basic 6.0
93/ wpfzufyg Program udk Run yguatmufygtwdkif;jrifawGU&rnf/ yHk(266)/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(266)
uGefysLwmvufpJG 258
Chapter (10)
Microsoft Visual 6.0 jzifh,cifoHk; Access zdkifwnfaqmufjcif;1/ yxrOD;pGm Microsoft Visual 6.0 udkzGifhyg/ xdkYaemuf yHk(267)yg Form1
wGif Command Button udkoHk;í atmufygtwdkif;zefwD;&rnf/ Command Button
rsm;wGif oufqdkif&m y½dk*&rfrsm;a&;om;&rnf/
2/ Open Database Command Button twGuf-Private Sub Command1_Click() Form1.Hide frmForm2.ShowEnd Sub
3/ Exit Command Button twGuf-Private Sub Command2_Click() Unload Me EndEnd Sub
4/ Menu Bar ½Sd Add-Ins udka½G;yg/ tay:qHk; Pulldown Menu wpfckjzpfonfhVisual Data Manager udka½G;yg/ yHk(268)/
5/ xdktcg VisData Window Dialog Box wpfckay:vmrnf/ yHk(269)/
yHk(267)
yHk(268)
259 Microsoft Visual Basic 6.0
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)/
7/ yHk(270)yg yHkrS Microsoft Access 4udka½G;cs,f&rnf/ xdktcg Version
2.0 MDB... ESifh Version 7.0 MDB... wdkYay:vmayrnf/ yHk(271)/
8/ 4if;rS Version 7.0 udka½G;cs,f&rnf/ xdktcgzdkifopfwnfaqmuf&ef zdkiftrnf
yHk(269)
yHk(270)
yHk(271)
uGefysLwmvufpJG 260
topfawmif;onfh Dialog Box ay:vmrnf/ yHk(272)/
9/ yHk(272)wGif zdkiftrnfay;NyD; Save udka½G;cs,fyg/ Oyrm/ Test01/ xdktcgDatabase Window ay:vmrnf/ yHk(273)/
10/ yHk(273)yg Database Window Dialog Box wGifyg0ifaom Properties
udka½G;NyD; Right Click ESdyfyg/ xdktcg Short Cut Menu wpfckyHk(274)ygtwdkif;ay:vmrnf/
11/ Short Cut Menu rS New Table udka½G;cs,f&rnf/ xdktcg Table Struc-
yHk(272)
yHk(273)
yHk(274)
261 Microsoft Visual Basic 6.0
ture Dialog Box ay:vmrnf/ yHk(275)/
12/ Table Name: List Box wGif Table File Name udkrdrdpdwfBuKdufjznfhpGufyg/Oyrm/ Test01 [k owfrSwfNyD; Add Field Command Button udka½G;cs,f&rnf/ xdktcgAdd Field Dialog Box ay:vmrnf/ 4if;wGif Field Name, Field Type, Field
Size wdkYudk pdwfBuKdufjznfhpGufNyD;aemuf OK udk Click jyKvkyfyg/ yHk(276)/
13/ xdkaemuf Add Field Dialog Box xyfrHay:vmNyD; rdrdBuKdwifpDrHxm;aomField Name, Field Type, Field Size rsm;udkowfrSwfNyD; OK udka½G;cs,f&rnf/ Field
tm;vHk;owfrSwfNyD;ygu Close Command Button udka½G;cs,fyg/ yHk(277)/
yHk(275)
yHk(276)
uGefysLwmvufpJG 262
14/ xdktcg yHk(278)ygtwdkif;jrifawGU&rnf/
15/ Field Type wGifatmufyg vkyfydkifcGifhtcsufrsm;yg0ifonf -
yHk(277)
yHk(278)
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 jyKvkyfvdkygu Add Index udka½G;cs,fyg/Add Index to Test01 Dialog Box ay:vmygu Name List Box wGif trnfowfrSwfyg/ Index Fields tm;rdrdowfrSwfvdkonfh Field Name udk Available Fields wGifDouble Click jyKvkyfjcif;jzifhwnfaqmufEdkifayonf/ xdkYaemuf OK udkowfrSwf&rnf/yHk(279)/
17/ yHk(279)wGif OK udkowfrSwfvdkufygu Table Structure Dialog Box ay:vmrnf/ yHk(280)/
yHk(279)
uGefysLwmvufpJG 264
18/ yHk(280)wGif Close Command Button udka½G;cs,fygu rdrdwnfaqmufxm;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 wpfckjyefvnfay:vmayrnf/
19/ xdkYaemuf Utility Menu rS Data Form Designer... udka½G;yg/ yHk(282)/
yHk(280)
yHk(281)
265 Microsoft Visual Basic 6.0
20/ xdktcg yHk(283)ygtwdkif; Data Form Designer Dialog Box ay:vmrnf/
21/ Form Name [w/o Extension]: List Box wGifrdrdowfrSwfvdkonfh trnfudkjznfhpGufyg/ Oyrm - Form2 [kjznfhpGufNyD; RecordSource: List Box wGif Dropdown
List Arrow udk Mouse jzif h Click jyKvkyfyg/ xdktcg Pulldown Menu xJrSrdrdzefwD;xm; onfh Table File tm;a½G;cs,fygu yHk(284)ygtwdkif;jzpfay:vmrnf/
yHk(282)
yHk(283)
uGefysLwmvufpJG 266
22/ yHk(284)wGif Available Fields: xJrS rdrdtvdk½Sdonfh Field rsm;tm; In-
cluded Fields: List Box xJodkY > or >> jzifhydkYyg/ Oyrm - Fields tm;vHk;udka½G;cs,fyg/yHk(285)twdkif; jrifawGU&rnf/
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)/
yHk(284)
yHk(285)
267 Microsoft Visual Basic 6.0
24/ yHk(286)yg Form yHkpHtm; yHk(287)ygtwdkif;odrf;qnf;&rnf/
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
yHk(286)
yHk(287)
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\MicrosoftVisualStudio\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.AddNewEnd 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 recordsetData1.Recordset.Delete
uGefysLwmvufpJG 272
Data1.Recordset.MoveNextEnd Sub
42/ Refresh Command Button twGuf -Private Sub cmdRefresh_Click()
'this is really only needed for multi user appsData1.Refresh
End Sub
43/ Update Command Button twGuf -Private Sub cmdUpdate_Click()
Data1.UpdateRecordData1.Recordset.Bookmark = Data1.Recordset.LastModified
End Sub
44/ Close Command Button twGuf -Private Sub cmdClose_Click()
frmForm2.HideForm1.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 themMsgBox "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 = vbDefaultOn Error Resume Next'This will display the current record position
273 Microsoft Visual Basic 6.0
'for dynasets and snapshotsData1.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)) + 1End 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 occurSelect Case Action
Case vbDataActionMoveFirstCase vbDataActionMovePreviousCase vbDataActionMoveNextCase vbDataActionMoveLastCase vbDataActionAddNewCase vbDataActionUpdateCase vbDataActionDeleteCase vbDataActionFindCase vbDataActionBookmarkCase vbDataActionClose
End SelectScreen.MousePointer = vbHourglass
End Sub
- - - - - - - - - - 0 - 0 - 0 - - - - - - - - - -
,cifoHk; Access zdkifudk Data Report wnfaqmufí Report wnfaqmufjcif;
uGefysLwmvufpJG 274
48/ yxrOD;pGm Microsoft Visual 6.0 udkzGifhyg/ xdkYaemuf yHk(288)yg Form1
wGif Command Button udkoHk;í atmufygtwdkif;zefwD;&rnf/
49/ xdkYaemuf Menu Bar ½Sd Project udka½G;yg/ xdkYaemuf Pulldown Menu
xJrS Add Data Report udkxyfrHa½G;cs,f&rnf/ yHk(289)/
50/ yHk(290)ygtwdkif; Project1 - DataReport1 [DataReport] Form ay:
yHk(288)
yHk(289)
275 Microsoft Visual Basic 6.0
vmayrnf/
51/ txufyg Report Form yHkpHtm;zefwD;vdkufonfESifh Project Explorer wGifvnf; yHk(291)ygtwdkif; DataReport1(DataReport1) topfwpfckwdk;vmayrnf/
52/ txufyg Report Form yHkpHtm;trnfajymif;vJ&ayrnf/ Properties - Data
Report1 wGif Name ü RDataReport1 [kajymif;vJowfrSwfyg/ yHk(292)/
yHk(290)
yHk(291)
uGefysLwmvufpJG 276
53/ Project Explorer wGi fvnf;y H k (293)ygtwd ki f ; RDataReport1
(DataReport1) [ktrnfajymif;oGm;ayrnf/
54/ tqdkyg RDataReport1(RDataReport1) File udkodrf;vdkygu 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)/
yHk(292)
yHk(292)
277 Microsoft Visual Basic 6.0
55/ xyfrHí Menu Bar jzpfaom Project rS More ActiveX Designers... udka½G;cs,f&rnf/ xdktcg Data Environment qdkonfh Sub-Menu wpfckxyfrHay:vmrnf/4if;udkxyfrHa½G;cs,fyg/ yHk(294)/
56/ xdktcg yHk(295)wGifazmfjyxm;aom Project1 - DataEnvironment1
yHk(293)
yHk(294)
uGefysLwmvufpJG 278
[DataEnvironment] Dialog Box ay:vmayrnf/ 4if;udktrnfajymif;&ef Proper-
ties udka½G;í Properties-DataEnvironment wGif Name RDataEnvironment1 [kajymif;vJowfrSwf&rnf/ yHk(296)/
57/ Project Explorer wGi fvnf;y H k (297)ygtwd ki f ; RDataReport1
(DataReport1) [ktrnfajymif;oGm;ayrnf/
yHk(295)
yHk(296)
279 Microsoft Visual Basic 6.0
58/ xdkaemuf Project1 - RDataEnvironment [DataEnvironment] wGif Con-
nection1 udka½G;í Right Click udkESdyfyg/ Short Cut Menu ay:vmygu yHk(298)wGifazmfjyxm;onfhtwdkif; Properties... udk xyfrHa½G;cs,fyg/
59/ xdktcg Data Link Properties Dialog Box ay:vmrnf/ 4if;rS Provider
yHk(297)
yHk(298)
uGefysLwmvufpJG 280
Tab Command Button udka½G;í Microsoft Jet 3.51 OLE DB Provider udka½G;cs,fyg/ yHk(299)/
60/ xdkYaemuf Connection Tab Command Button udka½G;cs,fyg/ yHk(300)ygtwdkif; 1. Select or enter a database name: List Box wGif Database File Name
awmif;ygu rdrdudk,fwdkif Database File Name ½dkufxnfhjcif;jzifhvnf;aumif;? udkxyfrHa½G;cs,fjcif;jzifhvnf;aumif; tvdk½Sdaom Database File Name udka½G;cs,fyg/yHk(301)/
yHk(299)
281 Microsoft Visual Basic 6.0
61/ Test Connection udka½G;cs,fygu rdrda½G;cs,fcJhaom Database File ESifhPath vrf;aMumif;rSefuefygu yHk(302)ygtwdkif;azmfjyrnfjzpfonf/
62/ xdkenf;wl Data Link Properties Dialog Box \ Tab Command But-
yHk(300)
yHk(301)
yHk(302)
uGefysLwmvufpJG 282
ton rsm;jzpfMuaom Advanced yHk(303) ESifh All yHk(304)wdkYwGifrnfonfhtcsufrQ ajymif;vJ&efrvdkbJ OK udka½G;cs,f&efjzpfygonf/
63/ xdkaemuf Project1 - RDataEnvironment [DataEnvironment] wGif Con-
yHk(303)
yHk(304)
283 Microsoft Visual Basic 6.0
nection1 udka½G;í Right Click udkESdyfyg/ Short Cut Menu ay:vmygu yHk(305)wGifazmfjyxm;onfhtwdkif; Add Command udk xyfrHa½G;cs,fyg/
64/ xdktcg yHk(306)ygtwdkif; jzpfay:vmrnf/
65/ tqdkyg RDataEnvironment1(RDataEnvironment1) File udkodrf;vdkygu
yHk(305)
yHk(306)
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 udka½G;cs,f&rnf/ yHk(307)/
66/ Project Explorer jzpfonfh Project-Project1 Dialog Box wGifvnf;RDataEnvironment1(RDataEnvironment1)tpm; RDataEnvironment1
(RDataEnvironment1.Dsr) tjzpfajymif;vJoGm;rnf/ yHk(308)/
67/ Project1 - RDataEnvironment [DataEnvironment] wGif Connection1
yHk(307)
yHk(308)
285 Microsoft Visual Basic 6.0
udka½G;í Right Click udkESdyfyg/ Short Cut Menu ay:vmygu yHk(309)wGifazmfjyxm;onfhtwdkif; Properties udk xyfrHa½G;cs,fyg/
68/ xdktcg Command1 Properties Dialog Box wpfckay:vmrnf/ 4if;wGifGeneral, Parameters, Relation, Grouping, Aggregates, Advanced qdkonfh Tab
Command Button (6)ckay:vmrnf/ 4if; Tab Command rsm;xJrS General Tab
Command udka½G;yg/ yHk(310)/
yHk(309)
uGefysLwmvufpJG 286
69/ Source of Data acgif;pOfatmufwGif½Sdaom Database Object: List Box
Dropdown Arrow udka½G;í Table udkajymif;yg/ Object Name: List Box wGifDropdown Arrow tultnDjzifhrdrdzefwD;xm;cJhaom Test01 udka½G;cs,f&rnf/ yHk(311)/
70/ usef Tab Command Button rsm;tm;jyKjyifp&mrvdkawmhonfhtwGuf Apply
-> OK udka½G;cs,fyg/ xdktcg Project1 - DataEnvironment1 [DataEnvironment]
Dialog Box ½Sd \ udka½G;ygu yHk(312)wGif azmfjyxm;ouJhodkY Field
Name rsm;azmfjyaeayrnf/
yHk(310)
yHk(311)
287 Microsoft Visual Basic 6.0
71/ xdkYaemuf Project1 - RDataReport1 [DataReport] udkjyefvnfqJGwif&rnf/yHk(313)/
72/ Page Header (Section2) Activate jzpfaeaomtcg Right Click udkESdyfyg/Short Cut Sub-Menu wpfckay:vmrnf/ 4if;rS Insert Control udka½G;NyD; Label
udkxyfrH a½G;cs,f&rnf/ yHk(314)/
yHk(312)
yHk(313)
uGefysLwmvufpJG 288
73/ xdktcg yHk(315)ygtwdkif;jzpfay:vmrnf/
74/ xdkenf;twdkif; Label (4)ckzefwD;NyD; Labour ID, Name, Date of Birth,
yHk(314)
yHk(315)
289 Microsoft Visual Basic 6.0
Salary ponfjzifhtrnfowfrSwfyg/ yHk(316)? yHk(317)/
75/ Detail (Section1) Activate jzpfaeaomtcg Right Click udkESdyfyg/ Short
Cut Sub-Menu wpfckay:vmrnf/ 4if;rS Insert Control udka½G;NyD; TextBox udkxyfrHa½G;cs,f&rnf/ yHk(318)/
yHk(316)
yHk(317)
uGefysLwmvufpJG 290
76/ xdktcg yHk(319)ygtwdkif;jzpfay:vmrnf/yHk(318)
291 Microsoft Visual Basic 6.0
77/ xdkenf;twdkif; TextBox (4)ckzefwD;&rnf/ yHk(320)/
78/ Project1 - RDataReport1 [DataReport] Activate jzpfaeaomtcgSmart 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 jzifhCommand1 udkxyfrHa½G;cs,f&rnf/
yHk(319)
yHk(320)
uGefysLwmvufpJG 292
79/ Detail (Section1) Activate jzpfap&efjyKvkyfí yxrOD;qHk;jrifawGUae&onfhText Box udka½G;yg/ Smart Icon jzpfaom \tultnDjzifh yHk(322)wGifazmfjyxm;onfhtwdkif; Properties - Text1 ü DataMember \ List Dropdown Arrow jzifhCommand1 udkvnf;aumif;? DataField \ List Dropdown Arrow jzifh LabourID
udkvnf;aumif;a½G;cs,f&rnf/ xd kenf;wlusef Text Box toD;oD;ud kvnf;DataMember, DataField wdkYudkqDavsmfatmifjyKvkyf&rnf/ yHk(323)/
yHk(321)
293 Microsoft Visual Basic 6.0
yHk(322)
yHk(323)
uGefysLwmvufpJG 294
80/ txufyg yHk(324)udkjyefoGm;NyD; oufqdkif&m Command Button rsm;wGifatmufazmfjyyg yHk(325)ygtwdkif; Coding rsm;udka&;&rnf/
rSwfcsuf/ / DataReport toHk;jyKygu DataEnvironment udkoHk;&rnf jzpfonf/DataEnvironment wGif Database File rwlnDygu Connection1, Connection2,
... [lí cJGjcm;toHk;jyKEdkifNyD; Database File wlnDNyD; Table File (rwlnDvQif) rsm;jym;aeygu Command1, Command2, ... zefwD;ítoHk;jyKEdkifygonf/
- - - - - - - - - - 0 - 0 - 0 - - - - - - - - - -
yHk(324)
yHk(325)
uGefysLwmvufpJG 295
,cifoHk; Access zdkifudk Form wnfaqmufí"gwfyHkrsm;Munfhjcif;81/ yxrOD;pGm Microsoft Visual 6.0 udkzGifhyg/ xdkYaemuf yHk(326)yg Form1
wGif Command Button rsm;udkoHk;í atmufygtwdkif;zefwD;NyD; vdktyfaomy½dk*&rfrsm;a&;om;&rnf/
82/ Data Entry Command Button twGuf-Private Sub Command1_Click()
frmForm2.ShowEnd Sub
83/ Exit Command Button twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
84/ xdkYaemuf yHk(327)yg frmForm2 wGifvdktyfaom Label, TextBox, OLE,
Data, Command Button rsm;udkoHk;&rnf/ vdktyfaom Properties rsm;udkvnf;jyifqif&rnf/
yHk(326)
uGefysLwmvufpJG 296
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
yHk(327)
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.AddNewEnd 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 recordsetData1.Recordset.DeleteData1.Recordset.MoveNext
End Sub
103/ Refresh Command Button twGuf -Private Sub cmdRefresh_Click()
'this is really only needed for multi user appsData1.Refresh
End Sub
104/ Update Command Button twGuf -Private Sub cmdUpdate_Click()
Data1.UpdateRecordData1.Recordset.Bookmark = Data1.Recordset.LastModified
End Sub
301 Microsoft Visual Basic 6.0
105/ Close Command Button twGuf -Private Sub cmdClose_Click()
frmForm2.HideForm1.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 themMsgBox "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 = vbDefaultOn Error Resume Next'This will display the current record position'for dynasets and snapshotsData1.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)) + 1End 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 occurSelect Case Action
Case vbDataActionMoveFirstCase vbDataActionMovePreviousCase vbDataActionMoveNextCase vbDataActionMoveLast
uGefysLwmvufpJG 302
Case vbDataActionAddNewCase vbDataActionUpdateCase vbDataActionDeleteCase vbDataActionFindCase vbDataActionBookmarkCase 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 tableoleFields(Index).InsertObjDlg
End Sub
- - - - - - - - - - 0 - 0 - 0 - - - - - - - - - -Toolbox xJwGif Crystal Report Smart Icon xnfhjcif;110/ Toolbox wGif Right Click ESdyfyg/ xdktcg Short Cut Menu ay:vmyguComponents... 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 udka½G;NyD; Check vkyf&rnf/ xdkYaemuf Apply, OK udkxyfrHa½G;cs,f&rnf/ yHk(329)/
112/ Crystal Report Control 4.6 udka½G;Ed kifjcif;onf C:\WINDOWS\
SYSTEM\CRYSTL32.OCX zdkif½Sdjcif;aMumifhjzpfonf/ xdktcg Toolbox ü Crys-
tal Report Icon a&muf½Sdvmrnf/ yHk(330)/
- - - - - - - - - - 0 - 0 - 0 - - - - - - - - - -
yHk(329)
yHk(330)
uGefysLwmvufpJG 304
Crystal Report wnfaqmufjcif; ( ,cif Access File )113/ yxrOD;pGm Visual Basic 6.0 udkzGifhyg/ xdkYaemuf Menu Bar rS Add-Ins
udk a½G;í Pulldown Menu wpfckjzpfaom Report Designer... udka½G;cs,f&rnf/ yHk(331)
114/ yHk(332)ygtwdkif;jzpfay:vmygu Cancel Command Button udka½G;cs,fyg/
yHk(331)
yHk(332)
305 Microsoft Visual Basic 6.0
115/ Crystal Reports Registration Express Dialog Box aysmufoGm;vdrfhrnf/xdktcg 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/
116/ Create New Report Dialog Box xJrS Standard udkxyfrHa½G;cs,fyguyHk(335)ygtwdkif;jzpfay:vmayrnf/
yHk(333)
yHk(334)
uGefysLwmvufpJG 306
117/ Create Report Expert Dialog Box wGif Data File Command Button
udk xyfrHa½G;cs,f&rnf/ yHk(336)/
118/ Choose Database File Dialog Box xyfrHay:vmNyD; rdrdtoHk;jyKvdkonfhDatabase 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)/
yHk(335)
yHk(336)
307 Microsoft Visual Basic 6.0
119/ Choose Database File Dialog Box \trSm;jcpf Close Button udka½G;jcif;jzifh aomfvnf;aumif;? Done Command Button udka½G;jcif;jzifhaomfvnf;aumif; xyfrHaqmif½Guf&rnf/ xdktcg Choose Database File Dialog Box aysmufoGm;rnf/ yHk(338)
yHk(337)
uGefysLwmvufpJG 308
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;xyfrHa½G;cs,fyg/ yHk(339)/
121/ Database Fields: acgif;pOfatmuf½Sd Database Fields: rsm;xJrS rdrdtvdk½Sdaom Field rsm;tm; Report Fields: acgif;pOfatmufodkYydkY&rnf/ Field wpfckcsif;a½G;vdkygu Command Button jzif ha½G;cs,fNyD; Field tm;vHk;a½G;vdkygu
Command Button jzifha½G;cs,f&rnf/ yHk(340)/
yHk(338)
yHk(339)
309 Microsoft Visual Basic 6.0
122/ xdkYaemuf Next>> Command Button udka½G;cs,fyg/ yHk(341)/
123/ xdktcg Tab Command wpfckjzpfaom 3: Sort odkYa&muf½SdoGm;rnf/ txufygyHk(341)wGif rdrdtkyfpkzJGUvdkonfh Field tm; tkyfpkzJGUEdkifonf/ tkyfpkzJGU&ef rvdktyfyguPreview Report udkxyfrHa½G;yg/ yHk(342)/
yHk(340)
yHk(341)
uGefysLwmvufpJG 310
124/ txufygyHkwGifazmfjyxm;aom Design tm;a½G;cs,fygu yHk(343)twdkif; jyKjyifrGrf;rHEdkif&ef tajctaeay;vdrfhrnf/
yHk(342)
311 Microsoft Visual Basic 6.0
125/ xdkYaemuf Menu Bar ½Sd Insert udka½G;cs,fyg/ Pulldown Menu wpfckjzpfaomText Field udka½G;cs,fyg/ yHk(344)/
yHk(343)
uGefysLwmvufpJG 312
126/ xdktcg Edit Text Field Dialog Box ay:vmNyD; acgif;pOftm;rdrdpdwfBuKdufzefwD;í&ayonf/ yHk(345)/ xdkYaemuf Accept Command Button udka½G;cs,fyg/
127/ acgif;pOftm; Alignment csdef&efrdrd½dkufESdyfxm;onfh acgif;pOf Text Box
tm; a½G;NyD; Right Click udka½G;yg/ Short Cut Menu ay:vmrnf/ xdkYaemuf Change
Format... udka½G;cs,f&rnf/ yHk(346)/
yHk(344)
yHk(345)
313 Microsoft Visual Basic 6.0
128/ xdktcg Format String Dialog Box ay:vmrnf/ yHk(347)4if;rS Align-
ment wGif Centered udk a½G;NyD; OK udkxyfrHa½G;cs,fygu acgif;pOfpmom; tv,fñd§oGm;ayrnf/ yHk(348)
yHk(346)
yHk(347)
uGefysLwmvufpJG 314
129/ txufyg Report File tm;odrf;vdkygu Menu Bar ½Sd File udka½G;cs,fyg/xdkYaemuf Pulldown Menu xJrS Save udka½G;cs,fyg/ yHk(349)
yHk(348)
yHk(349)
315 Microsoft Visual Basic 6.0
130/ xdktcg File Save As Dialog Box ay:vmrnf/ rdrdpdwfBuKdufodrf;vdkonfhzdkiftrnfudkay;NyD; OK udk Click vkyf&rnf/ yHk(350)/
131/ Crystal Reports Title Bar onfvnf; [Untitled Report #1] r[kwfawmhbJ [c:\program files\microsoft visual studio\vb98\std09.rpt] [líajymif;vJoGm;ayrnf/ yHk(351)/
- - - - - - - - - - 0 - 0 - 0 - - - - - - - - - -
yHk(350)
yHk(351)
uGefysLwmvufpJG 316
Crystal Report wnfaqmufjcif; ( Access File 2000 txuf )132/ yxrOD;pGm Visual Basic 6.0 udkzGifhyg/ xdkYaemuf Menu Bar rS Add-Ins
udk a½G;í Pulldown Menu wpfckjzpfaom 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)
133/ xdktcg Log On Server Dialog Box topfwpfckay:vmrnf/ yHk(353)
134/ yHk(353)yg Dialog Box rS ODBC:exam01 udka½G;cs,fyg/ xdkYaemuf OK
udk Click vkyfyg/ xdktcg Choose SQL Table Dialog Box ay:vmrnf/ yHk(354)/
yHk(352)
yHk(353)
317 Microsoft Visual Basic 6.0
135/ Choose SQL Table Dialog Box xJrS SQL Tables: acgif;pOfatmuf½SdList Box wGif rdrdpdwfBuKduf Table File udkda½G;cs,f&rnf/ Oyrm - exam01 udka½G;cs,fyg/Add Command Button udkxyfrHa½G;cs,fyg/ Close Button udka½G;cs,fygu yHk(355)ygtwdkif;jzpfvmrnf/
136/ yHk(355)wGif Next >> Command Button udkxyfrHa½G;cs,f&rnf/ yHk(356)ygtwdkif;azmfjyrnf/
yHk(354)
yHk(355)
uGefysLwmvufpJG 318
137/ txufygyHk(356)wGif Database Fields: ü Field rsm;pdwfBuKduf(odkYr[kwf)tm;vHk;udk a½G;cs,fEdkifayonf/ Oyrm-Fields rsm;tm;vHk;a½G;cs,f&ef All->>Command
Button udka½G;cs,f&rnf/ yHk(357)
138/ xdkYaemuf Next udkxyfrHa½G;cs,fyg/ yHk(358)ygtwdkif;azmfjyrnf/
yHk(356)
yHk(357)
319 Microsoft Visual Basic 6.0
139/ txufygyHk(358)wGif Group Fields aqmif½Gufvdkygu vkyfydkifcGifhay;xm;NyD;raqmif½Gufvdkygu Preview Report Command Button udka½G;cs,f&rnf/ xdktcgyHk(359)twdkif; jzpfay:vmrnf/
yHk(358)
yHk(359)
uGefysLwmvufpJG 320
140/ Design Tab Command Button udka½G;cs,fygu yHk(360)ygtwdkif;jzpfay:vmrnf/
141/ txufygyHk(360)wGifazmfjyxm;aom Crystal Report File tm;odrf;vdkyguMenu Bar wGif½Sdonfh File udka½G;cs,fyg/ Pulldown Menu wpfckjzpfaom Save udka½G;cs,fyg/ xdktcg File Save As Dialog Box ay:vmrnf/ rdrdpdwfBuKdufvrf;aMumif;wGif Report File Name udkjznfhpGufNyD; OK Command Button udka½G;cs,f&rnf/yHk(361)/
yHk(360)
321 Microsoft Visual Basic 6.0
- - - - - - - - - - 0 - 0 - 0 - - - - - - - - - -Crystal Report jzifh Graphic File ½dkufxkwfjcif;142/ yxrOD;pGm Visual Basic 6.0 wGif "gwfyHkrsm;yg0ifaom Access File udkwnfaqmufxm;&rnf/ "gwfyHkrsm;udk Windows BitMap File Format jzifhom Data
Entry jyKvkyf&rnf/ Access 2000 xufapmaom ,cif Access File rsm;twGufrlCrystal Report \vkyfydkifcGifhjzpfaom Create Report Expert Dialog Box ay:vmatmifzefwD;í Data File Command Button udka½G;&rnf/ Access 2000 ESifh txufAccess File rsm;twGufrl Crystal Report \vkyfydkifcGifhjzpfaom Create Report Ex-
pert Dialog Box ay:vmatmifzefwD;í SQL/ODBC File Command Button udka½G;&rnf/
yHk(361)
yHk(362)
uGefysLwmvufpJG 322
143/ xdktcg Log On Server Dialog Box ay:vmrnf/ Server Type: acgif;pOfatmufwGif rdrda½G;cs,frnfh Database File tm;½SmazG&rnf/ Oyrm - ODBC - Photo01
udka½G;cs,fyg/ xdkYaemuf OK udk Click vkyf&rnf/ yHk(363)/
144/ Choose SQL Table Dialog Box ay:vmygu rdrdwnfaqmufxm;aomDatabase File xJwGifyg0ifonfh Table File udka½G;cs,fNyD; Add Command Button
udk xyfrHa½G;cs,f&rnf/ yHk(364)/
145/ Create Report Expert Dialog Box ay:vmNyD; Table File jzpfonfhPhoto01 File ay:vmrnf/ yHk(365)/
yHk(363)
yHk(364)
323 Microsoft Visual Basic 6.0
146/ yHk(365)wGif Next >> Command Button udkxyfrHa½G;cs,f&rnf/ yHk(366)ygtwdkif;azmfjyrnf/
147/ txufygyHk(366)wGif Database Fields: ü Field rsm;pdwfBuKduf(odkYr[kwf)tm;vHk;udk a½G;cs,fEdkifayonf/ Oyrm-Fields rsm;tm;vHk;a½G;cs,f&ef All->>Command
Button udka½G;cs,f&rnf/ yHk(367)
yHk(365)
yHk(366)
uGefysLwmvufpJG 324
148/ xdkYaemuf Next udkxyfrHa½G;cs,fyg/ yHk(368)ygtwdkif;azmfjyrnf/
149/ txufygyHk(368)wGif Group Fields aqmif½Gufvdkygu vkyfydkifcGifhay;xm;NyD;raqmif½Gufvdkygu Preview Report Command Button udka½G;cs,f&rnf/ xdktcgyHk(369)twdkif; jzpfay:vmrnf/
yHk(367)
yHk(368)
325 Microsoft Visual Basic 6.0
150/ Design Tab Command Button udka½G;cs,fygu yHk(370)ygtwdkif;jzpfay:vmrnf/
yHk(369)
uGefysLwmvufpJG 326
151/ Design View wGif Band (5)ckyg½Sdrnfjzpfonf/ Title, Page header, De-
tails, Page footer, Summary wdkYjzpfMuonf/ Title onf acgif;pOfBuD;twGufjzpfNyD;?Page header onf pm½Gufwdkif;wGifyg½Sdrnfh tkyfpkacgif;pOfrsm;? &ufpJG? pmrsufESmeHygwfrsm;jzpfEdkifonf/ Details onf Record rsm;azmfjy&eftwGuf Template rsm;jzpfayonf/Page footer onfpm½GuftoD;oD;\atmufqHk;wGifyg0if&rnfh &ufpJG? pmrsufESm eHygwfrsm;jzpfEdkifygonf/ Details ESifh Page footer udk"gwfyHkrsm;xnfhoGif;&efoifhwifhrQwpGmjcm;&rnf/ xdkYaemuf Menu Bar ½Sd Insert udka½G;yg/ Pulldown Menu jzpfaom Data-
base Field udkxyfrHa½G;cs,f&rnf/ yHk(371)
yHk(370)
327 Microsoft Visual Basic 6.0
152/ xdktcg Insert Database Field Dialog Box rS Field wpfckjzpfaom pho-
tos udka½G;NyD; Insert Command Button udka½G;cs,f&rnf/ yHk(372)
yHk(371)
yHk(372)
uGefysLwmvufpJG 328
153/ xdktcg yHk(373)ygtwdkif; "gwfyHk½Sd&rnfhtuGufudkcsdefqí tpm;xdk;twnfjyKNyD;aomtcg Insert -> Text Field jzifh vdktyfrnfhpmom;rsm;a&;om;yg/ yHk(374)/
154/ tqdkyg Crystal Report File tm; File -> Save udka½G;NyD; Report File
Name ay;&efjzpfonf/- - - - - - - - - - 0 - 0 - 0 - - - - - - - - - -
yHk(373)
yHk(374)
329 Microsoft Visual Basic 6.0
Access zdkifudk Crystal Report wnfaqmufí Print ½dkufxkwfjcif;155/ yHk(375)yg Form1 wGif Command Button rsm;udkoHk;í atmufygtwdkif;zefwD;wnfaqmufNyD; y½dk*&rfa&;&rnf/
Crystal Report
Private Sub Command1_Click()CrystalReport1.PrintReport
End Sub
Private Sub Command2_Click()Unload MeEnd
End Sub
156/ Microsoft Visual Basic 6.0 wGif Menu Bar wpfckjzpfaom Add-ins udka½G;cs,fyg/ xdkYaemuf Pulldown Menu xJrS Report Designer... jzifh *.rpt File
wpfzdkifudkwnfaqmufxm;&rnf/ Oyrm-c:\program files\microsoft visual studio\
vb98\ exam01.rpt udkwnfaqmufxm;&rnf/ yHk(376)/
yHk(375)
uGefysLwmvufpJG 330
157/ Crystal Report \ Properties wGif-(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
yHk(376)
331 Microsoft Visual Basic 6.0
( ') ReportFileName - C:\Program Files\Microsoft VisualS t u d i o \ V B 9 8 \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... udka½G;cs,fyg/ yHk(377)/
159/ xdktcg VisData Dialog Box ay:vmvdrfhrnf/ 4if;rS Menu Bar jzpfaomFile udka½G;cs,fyg/ xdkYaemuf New udkxyfrHa½G;cs,f&rnf/ yHk(378)/
yHk(377)
uGefysLwmvufpJG 332
160/ yHk(378)ygtwdkif; New... udka½G;cs,fygu xyfrHí Sub-Menu wpfckay:vmrnf/ 4if;rS rdrdzefwD;wnfaqmufrnfh Microsoft Access udka½G;cs,fyg/ xdktcgxyfrHíSub-Menu wpfckay:vmayrnf/ 4if; Sub-Menu rS Version 7.0 MDB... udka½G;cs,f&rnf/ yHk(379)/ yHk(380)ygtwdkif;ay:vmrnf/
yHk(378)
yHk(379)
333 Microsoft Visual Basic 6.0
161/ yHk(380)wGif Select Microsoft Access Database to Create Dialog Box
ay:vmygu rdrdwnfaqmuftrnfay;vdkonfh Database File trnfudkjznfhpGufí Save
Command Button udka½G;cs,f&ayrnf/ Oyrm - Lucky [kjznfhpGufNyD; Save Com-
mand Button udka½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(380)
yHk(381)
uGefysLwmvufpJG 334
162/ Database Window Dialog Box wGif Properties udka½G;cs,fyg/ xdkYaemufRight Click ESdyfygu Sub-Menu wpfckay:vmrnf/ xdk Sub-Menu xJrS New Table
udka½G;cs,fyg/ yHk(382)/
163/ xdktcg Table Structure Dialog Box ay:vmrnf/ Table Name acgif;pOfab; List Box ü rdrdpdwfBuKduf Table File trnfudkjznfhpGufí Add Field Com-
mand Button udka½G;cs,f&rnf/ yHk(383)/
yHk(382)
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)/
165/ Field Name wpfckcsif;oGif;NyD;ygu OK Command Button udka½G;cs,f&rnf/Field Name xyfrHroGif;vdkawmhygu Close Command Button udka½G;cs,fyg/ xdktcgyHk(386)ygtwdkif;jzpfay:vmrnf/
yHk(384)
yHk(385)
uGefysLwmvufpJG 336
166/ Index Field owfrSwfvdkygu Add Index Command Button udka½G;cs,f&rnf/ xdktcg 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(386)
yHk(387)
337 Microsoft Visual Basic 6.0
167/ xdktcg rlv Table Structure Dialog Box odkYjyefvnfa&muf½SdoGm;rnf/yHk(388)/
168/ txufyg Table Structure udkodrf;vdkygu Build the Table Command
Button udka½G;cs,f&rnf/ rlv Database Window Dialog Box odkYjyefvnfa&muf½SdoGm;ayrnf/ Close Command Button udka½G;cs,fygu tqdkyg Luck01 Table File
udkodrf;rnfr[kwfyg/ yHk(389)/
yHk(388)
uGefysLwmvufpJG 338
169/ C:\Program Files\LuckDraw\Lucky.mdb udkwnfaqmufNyD; Luck01
Table File ukdwnfaqmufcJhNyD;jzpfonf/ ,cktcg 4if; Database File xJwGifyif Luck02
Table File udkxyfrHwnfaqmuf&rnf/ Luck01 ESifh Luck02 Table File rsm;rSm tm;vHk;wlnDMuojzifh Luck02 Table File tm; Luck01 Table File uJhodkYyif tptqHk;jyefwnfaqmufyguvnf;&onf/ jzwfvrf;enf;jzifhwnfaqmufvdkygu yHk(389)wGif jrifawGUae&aom Database Window Dialog Box rS Luck01 udka½G;yg/ xdkYaemuf Right
Click ESdyfyg/ xdktcg Short Cut Menu wpfckay:vmrnf/ yHk(390)/
yHk(389)
yHk(390)
339 Microsoft Visual Basic 6.0
170/ Short Cut Menu xJrS Copy Structure... udkxyfrHa½G;cs,fyg/ xdktcgyHk(391)yg Copy Structure Dialog Box ay:vmrnf/
171/ 4if; Dialog Box rS Target Connect String: acgif;pOfatmuf Text Box
ü Lucky [kjznfhpGufNyD; Table: acgif;pOfatmuf Text Box ü Luck01 udka½G;cs,f&rnfjzpfNyD; Copy Data Check Box udk Check jyKvkyf&efjzpfonf/ xdkYaemuf OK Com-
mand Button udka½G;cs,fyg/ yHk(392)/
172/ xdktcg VisData Dialog Box ay:vmrnf/ Enter New Table Name
acgif;pOfatmuf Text Box ü rdrdwnfaqmufvdkonfh Table Name udkjznfhpGuf&rnf/Oyrm - Luck02 [kjznfhpGufNyD; OK Command Button udka½G;cs,f&rnf/ yHk(394)/
yHk(391)
yHk(392)
uGefysLwmvufpJG 340
173/ xdktcg Copy Structure Dialog ay:vmrnf/ rdrdul;vdkonfh Structure
atmifjrifpGmul;NyD;aMumif; Message Box ay:vmayrnf/ OK Command Button
udka½G;yg/ yHk(394)/
174/ xdktcg Lucky.mdb Database File xJwGif Luck01 Table File ESifhtvm;oP²mefwlaom Luck02 Table File jzpfvmrnf/ yHk(395)/
yHk(393)
yHk(394)
yHk(395)
341 Microsoft Visual Basic 6.0
175/ uHprf;rJazgufrnfh y½d k*&rfa&;om;&eftwGufatmufyg Form yHkpHudkwnfaqmuf&rnf/ yHk(396)/
176/ yHk(396)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu
Label, Text Box, Command Button, Data, Frame wdkYyg0ifNyD;
4if;wdkY\ Properties rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGifvdktyfaomy½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
yHk(396)
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 (qkrJeHygwf tm;uHxl;½SiftrSwf 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 (qkrJeHygwf 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 atmuf0Sufxm;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 RecordsetDim zaw As BooleanDim a, b As Integera = Val(Text1)b = Val(Text3)If Text1 <> Empty Then
Text5 = b + 1Text3 = b + 1Text5 = Text3If b + 1 >= a Then
Text3 = b + 1Text5 = b + 1Text6 = 0Command1.Visible = FalseForm2.Show
End IfText5.ForeColor = "255"
ElseForm3.Show
End IfText6.ForeColor = "0"''''''''zaw = TrueSet MyDb = Workspaces(0).OpenDatabase("c:\Program Files\
LuckyDraw\Lucky.mdb")Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable)MyData.MoveFirstc = Text2sn = Text3en = 0d = Int(Rnd() * c) + 1
347 Microsoft Visual Basic 6.0
Do While zaw = TrueMyData.Index = "Luckno"MyData.Seek "=", dIf MyData.NoMatch Then
zaw = FalseElse
d = Int(Rnd() * c + 1)End If
LoopText6 = dText4 = dMyData.AddNewMyData("Luckno") = Text6MyData.UpdateText6.ForeColor = "65535"Text7 = 0Data1.Refresh
End Sub
199/ y½dk*&rfrSxGuf&ef Command Button2 twGuf-Private Sub Command2_Click()
Unload MeEnd
End Sub
200/ uHprf;rJtrnfpm&if;Munfh&ef Command Button3 twGuf-Private Sub Command3_Click()
Dim MyDb As Database, MyData As Recordset, MyDatapp As RecordsetDim ss As IntegerSet 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.MoveFirstDo While MyDatapp.EOF = False
uGefysLwmvufpJG 348
MyDatapp.DeleteMyDatapp.MoveNext
LoopEnd IfMyData.MoveFirstss = 0Do While MyData.EOF = False
yy = MyData("Luckno")If yy < 9999 And yy <> 0 Then
MyDatapp.AddNewMyDatapp("Luckno") = yyMyDatapp("srno") = ssMyDatapp.Update
End IfMyData.MoveNextss = ss + 1
LoopMyDatapp.MoveFirstForm5.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.AddNewMyData("Luckno") = 0MyData.UpdateData1.Refresh
End Sub
349 Microsoft Visual Basic 6.0
203/ Form Unload twGufPrivate Sub Form_Unload(Cancel As Integer)
Set MyDb = Workspaces(0).OpenDatabase("c:\Program Files\LuckyDraw\Lucky.mdb")
Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable)MyData.MoveFirstDo Until MyData.EOF
MyData.DeleteMyData.MoveNext
LoopData1.Refresh
End Sub
204/ Lucky Draw Program BuD;udk Run í&Edkifap&ef yHk(397)wGifyg0ifaomForm File rsm;udkwnfaqmuf&ayrnf/
yHk(397)
uGefysLwmvufpJG 350
205/ qufvufí Form2 udkwnfaqmuf&ayrnf/ yHk(398)/
206/ yHk(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
yHk(398)
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.HideUnload Form2
End Sub
211/ qufvufí Form3 udkwnfaqmuf&ayrnf/ yHk(399)/
212/ yHk(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
yHk(399)
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.HideUnload Form3Form1.Show
End Sub
217/ qufvufí Form4 udkwnfaqmuf&ayrnf/ yHk(400)/
yHk(400)
353 Microsoft Visual Basic 6.0
218/ yHk(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.HideUnload Form4
End Sub
uGefysLwmvufpJG 354
223/ qufvufí Form5 udkwnfaqmuf&ayrnf/ yHk(401)/
224/ yHk(401)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu
DBGrid, Data, Command ButtonwdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udk
jyifqifjznfhpGufNyD;aemuf Command Button wGif vdktyfaomy½dk*&rfrsm; a&;om;&rnfjzpfonf/
225/ DBGrid1 - DBGrid Properties rSm -(u) (Name) - DBGrid1( c) Align - 0 - vbAlignNone( *) AllowAddNew - False(C) AllowArrows - True( i) AllowDelete - False( p) AllowUpdate - True
yHk(401)
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 MeEnd Sub
229/ Data1 Reposition twGuf-Private Sub Data1_Reposition()
Data1.Caption = " Record: " & (Data1.Recordset.AbsolutePosition + 1)End Sub
230/ tqdkyg y½dk*&rfudk Run ygu yHk(402)ygtwdkif;jrifawGU&rnf/
uGefysLwmvufpJG 356
231/ Oyrm - qkrJta&twGuf 6 ckom½SdNyD;? uHprf;rnfhta&twGufrSm 125 OD;½SdyguqkrJta&twGufnmzuf½Sd tqdkyg y½dk*&rfudk Run ygu yHk(402)ygtwdkif;jrifawGU&rnf/qkrJta&twGuf 6 ck½Sdojzifh uHprf;&ef Command Button tm; 6 cgESdyfNyD;yguuHprf;rJukefaeygNyD[laom Message Box jyvmrnf/ yHk(403)/
232/ tqdkyg Message Box tm; ydwf&ef Command Button udkESdyfygu Mes-
sage Box aysmufoGm;NyD;? uHprf;&ef Command Button ygaysmufoGm;vdrfhrnf/ yHk(404)/
yHk(402)
yHk(403)
357 Microsoft Visual Basic 6.0
233/ uHprf;rJtrnfpm&if;Munfh&ef Command Button udkESdyfygu yHk(405)ygtwdkif;jrifawGU&rnf/
234/ txufyg Form yHkpHwGif ydwf&ef Command Button udka½G;cs,fygu rlvuHprf;rJEdIufonfh Form yHkpHodkYjyefvnfa&muf½SdoGm;NyD;? y½dk*&rfrSxGuf&ef Command
Button udkESdyfygu tqdkyg Form yHkpHrSxGufoGm;vdrfhrnf/- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(404)
yHk(405)
uGefysLwmvufpJG 358
ODBC jzifhzefwD;xm;aom Access zdkifudktouf? vkyfouf? yifpif,lrnfhESpfwGufjcif;235/ Access 2000 (or) Access 2002 wdkYjzifh Database File wpfckudkwnfaqmufxm;&rnf/ 4if; Database File rS Table File wGifatmufygZ,m;twdkif;wnfaqmufxm;NyD; Record rsm;xnfhxm;&rnf-
Field Name Data Type Field Size
IDNo Text 8Name Text 30Date of Birth DateEnrollment DateAge Number Double, Fixed, Decimal 2Services Year Number Double, Fixed, Decimal 2Retire Year Date
236/ Oyrm - Retire [k Database File, Table File wdkYwGiftrnfay;xm;yg/xdkYaemuf 4if;zdkifudk ODBC \vkyfydkifcGifhodkYajymif;vJNyD; Microsoft Visual Basic 6.0
jzifh atmufazmfjyyg Form yHkpHudkwnfaqmufxm;&rnf/
237/ yHk(406)yg Form yHkpHwGif , , 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
yHk(406)
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] fromretire 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.EventStatusEnum, 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.MoveFirstDo While Adodc1.Recordset.EOF = False
x = (Date - Adodc1.Recordset("Date of Birth")) / 365.25Adodc1.Recordset("Age") = xAdodc1.Recordset.MoveNext
LoopAdodc1.Recordset.MoveFirst
End Sub
uGefysLwmvufpJG 360
242/ Services Command Button twGuf -Private Sub Command2_Click()
Adodc1.Recordset.MoveFirstDo While Adodc1.Recordset.EOF = False
y = (Date - Adodc1.Recordset("Enrollment")) / 365.25Adodc1.Recordset("Services Year") = yAdodc1.Recordset.MoveNext
LoopAdodc1.Recordset.MoveFirst
End Sub
243/ Retire Year Command Button twGuf -Private Sub Command3_Click()
Adodc1.Recordset.MoveFirstDo While Adodc1.Recordset.EOF = False
mdy = Adodc1.Recordset("Date of Birth")myear = Year(mdy) + 60mmth = Month(mdy)mday = Day(mdy)zzz = mday & "-" & mmth & "-" & myearAdodc1.Recordset("Retire Year") = zzzAdodc1.Recordset.MoveNext
LoopAdodc1.Recordset.MoveFirst
End Sub
244/ Exit Command Button twGuf -Private Sub Command4_Click()
Unload MeEnd
End Sub
245/ tqdkygy½dk*&rfudk 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
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(406)
yHk(407)
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;xnfhxm;&rnf/
Field Name Data Type Field Size
IDNo Text 8Name Text 25Date of Birth DateEnrollment DateAge DoubleServices Year DoubleRetire Year Date
247/ Oyrm - Retired [k Database File, Table File wdkYwGiftrnfay;xm;yg/xdkYaemuf Microsoft Visual Basic 6.0 jzifh atmufazmfjyyg Form yHkpHudkwnfaqmufxm;&rnf/
248/ yHk(408)yg Form yHkpHwGif rsm;jzifh zefwD;xm;NyD; oufqdkif&mProperties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef jzpfygonf/
yHk(408)
363 Microsoft Visual Basic 6.0
249/ Report Command Button twGuf-Private Sub Command1_Click()
Command3.Visible = TrueCommand4.Visible = True
End Sub
250/ Exit Command Button twGuf-Private Sub Command2_Click()
Command3.Visible = FalseCommand4.Visible = FalseUnload MeEnd
End Sub
251/ Soft Copy Command Button twGuf-Private Sub Command3_Click()
Form3.ShowEnd Sub
252/ Hard Copy Command Button twGuf-Private Sub Command4_Click()
Form2.ShowEnd Sub
253/ Form Load twGuf-Private Sub Form_Load()
Command3.Visible = FalseCommand4.Visible = False
End Sub
254/ Soft Copy Command Button udka½G;cs,fygu Form2.Show [ky½dk*&rfa&;om;xm;ojzifh Form2 udkyHk(409)ygtwdkif;zefwD;wnfaqmuf&rnf/
uGefysLwmvufpJG 364
255/ yHk(409)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu
DBGrid, Label, Text Box, Data, Command ButtonwdkYyg0ifNyD;
4if;wdkY\ Properties rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button wGif vdktyfaomy½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
yHk(409)
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.MoveFirstDo While MyData.EOF = False
MyData.Editx = (Date - MyData("Date of Birth")) / 365.25MyData("Age") = xMyData.UpdateMyData.MoveNext
LoopMyData.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.MoveFirstDo While MyData.EOF = False
MyData.Edity = (Date - MyData("Enrollment")) / 365.25MyData("Services Year") = yMyData.UpdateMyData.MoveNext
LoopMyData.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.MoveFirstDo While MyData.EOF = False
MyData.Editmdy = MyData("Date of Birth")myear = Year(mdy) + 60mmth = Month(mdy)mday = Day(mdy)zzz = mday & "-" & mmth & "-" & myearMyData("Retire Year") = zzzMyData.UpdateMyData.MoveNext
LoopMyData.MoveFirst
End Sub
267/ Return to Main Menu Command Button4 twGuf-Private Sub Command4_Click()
Unload MeEnd 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.MoveLastText1.Text = MyData.RecordCount
End Sub
uGefysLwmvufpJG 368
270/ tqdkygy½dk*&rfudk 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*&rfa&;om;xm;ojzifh Form3 udkyHk(411)ygtwdkif;zefwD;wnfaqmuf&rnf/
272/ yHk(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 vdktyfaomy½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&ef0
(C) List - [List]Window ^ Enter jzifh½dkuf&efPrinter
( i) Style - 0 - DropdownCombo( p) Text - Window
274/ Label1 - Label Properties rSm-(u) (Name) - Label1( c) Alignment - 2 - Center
yHk(411)
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" ThenForm4.Show
End IfEnd Sub
282/ Print Report Command Button twGuf-Private Sub Command1_Click()
If Combo1.Text = "Window" Thenrpt1 = 0
ElseCombo1.Text = "Printer"rpt1 = 1Report1.CopiesToPrinter = num1
End Ifpt1 = "{Retired.IDNo} in '" + Trim(Text1.Text) + "' to '" +
Trim(Text2.Text) + "'"Report1.SelectionFormula = pt1Report1.Destination = rpt1
uGefysLwmvufpJG 372
a1 = LCase(App.Path)If Right(App.Path, 1) <> "\" Then a1 = a1 + "\" 'Handles the rootReport1.DataFiles(0) = a1 + "Retired.mdb"Report1.ReportFileName = a1 + "Retired.rpt"Report1.Action = 1
End Sub
283/ tqdkygy½dk*&rfudk Run ygu yHk(412)ygtwdkif;jrifawGU&rnf/ Print Desti-
nation nmzuf½Sd Combo Box Dropdown Arrow udka½G;cs,fygu Window ESifhPrinter [l íjrifawGU&NyD; rdrdtvdk½Sd&mudka½G;cs,fEdkifygonf/ Identification Number
From \nmzuf Text Box wGif Record Identification Number rdrdpvdkonfheHygwfrSp&efjzpfNyD; To \nmzuf Text Box ü rdrdtqHk;owf½dkufESdyfvdkonfh Record
Identification Number udkjyifqifjznfhpGuf&efjzpfonf/ Print Report Command
Button udkESdyfygu Combo Box udk Window a½G;cs,fcJhygu Printer jzifh½dkufESdyf&efPrint Preview udk jyrnfjzpfNyD; Printer udka½G;cs,fcJhygu wdkuf½dkuf Printer jzifh ½dkufESdyfrnfjzpfygonf/
yHk(412)
373 Microsoft Visual Basic 6.0
284/ Combo Box wGif Printer udka½G;cs,fygu Form4.Show [ky½dk*&rfa&;om;xm;jzifh Form4 udkyHk(413)ygtwdkif;zefwD;wnfaqmuf&rnf/
285/ yHk(413)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;udkavhvmygu
Label, Text Box, Command ButtonwdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udkjyifqif jznfhpGufNyD;aemuf Command Button wGif vdktyfaomy½dk*&rfrsm; a&;om;&rnfjzpfonf/
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
yHk(413)
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.HideEnd 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'fa&;om;yg/ Oyrm - vuf½SdESpf-v-&uf-em&D-rdepf-puúefYudkjyaom Program wpfyk'fudka&;om;xm;&rnf/ zdkif\y½dk*&rftrnfudk extest017.vbp [ktrnfowfrSwfxm;NyD;Form File udk extest017 .frm [ktrnfowfrSwfyg/ yHk(414)/
294/ txufygzdkifudk Execute File vkyfrnfqdkygu Menu Bar ½Sd File udka½G;yg/Pull Down Menu usvmygu 4if;xJrS Make extest017.exe... udka½G;cs,f&rnf/yHk(415)/
yHk(414)
uGefysLwmvufpJG 376
yHk(415)
yHk(416)
377 Microsoft Visual Basic 6.0
295/ xdktcg Make Project Dialog Box ay:vmrnf/ rdrdodrf;vdkonfhvrf;aMumif;? rdrdodrf;vdkonfh zdkiftrnfudk jyKjyifjznfhpGufí Execute File udkwnfaqmufEdkifayonf/ yHk(417)? yHk(418)/
yHk(417)
yHk(418)
uGefysLwmvufpJG 378
296/ xdktcgrdrdtrnfay;vdkufonfhtwdkif; c:\Example001.exe jzpfoGm;ayrnf/4if;zdkifudk Run vdkygu Computer Desktop wGif½Sdaeaom My Computer Short
Cut Icon udk Double Click (or) Active jzpfaeaomtcg Enter ESdyfyg/ yHk(419)/
297/ xdktcgyHk(420)wGifazmfjyxm;onfhtwdkif;[C:]udkDouble Click (or) Active
jzpfaeaomtcg Enter ESdyfyg/
yHk(419)
yHk(420)
379 Microsoft Visual Basic 6.0
298/ yHk(421)wGifjrifawGUae&aom Example001.exe zdkifudk Run vdkygu Double
Click (or) Active jzpfaeaomtcg Enter ESdyfyg/
yHk(421)
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/
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 - - - - - - - - - - - - - - -
yHk(423)
381 Microsoft Visual Basic 6.0
Visual Basic 6.0 jzifh Program wpfcktm;a&;NyD; Package jyKvkyfjcif;301/ yxrtqifhtaejzifh Microsoft Visual Basic 6.0 jzifh Program wpfyk'fa&;om;yg/ Oyrm - Database File wpfzdkifwnfaqmufNyD; Record tenf;i,foGif;xm;&rnf/ tqdkyg Database File wGif½Sd Record tcsKdUudk wGufcsufay;onfh y½dk*&rfwpfyk'ftm;a&;om;xm; &rnf/ zdkif\y½dk*&rftrnfudk extest111.vbp [ktrnfowfrSwfxm;NyD;Form File udk extest111 .frm [ktrnfowfrSwfyg/ yHk(424)/
302/ txufygzdkifudk Application Package vkyfrnfqdkygu Menu Bar ½Sd Add-
Ins udka½G;yg/ Pull Down Menu usvmygu 4if;xJrS Package and Deployment
Wizard... udka½G;cs,f&rnf/ yHk(425)/
yHk(424)
yHk(425)
uGefysLwmvufpJG 382
303/ xdktcg Package and Deployment Wizard Dialog Box ay:vmrnf/yHk(426)? Package rjyKvkyfrDtqdkyg Project File udkodrf;vdkygu Yes udka½G;&efjzpfNyD;?rodrf;vdk ygu No udka½G;cs,f&rnf/ yHk(426)/ Oyrm - No udka½G;yg/
304/ Package and Deployment Wizard Dialog Box ay:vmrnf/ 4if; Dia-
log Box wGif rdrd Package vkyfvdkonfh Visual Basic Project File \ wnfae&mudkjyaernfjzpfNyD; Package Command Button udka½G;cs,f&rnf/ yHk(427)/
305/ xdkaemuf Compile Command Button udka½G;cs,f&rnf/ xdktcgrSomExecute File &½Sdayrnf/ yHk(428)/
yHk(426)
yHk(427)
383 Microsoft Visual Basic 6.0
306/ Compile vkyfNyD;oGm;ygu yHk(429)yg Dialog Box ay:vmygu Yes Com-
mand Button udka½G;cs,fyg/
307/ Package trsKd;tpm;a½G;cs,fonfh Dialog Box ay:vmrnf/ Package Type
udk Standard Setup Package ae&mwGifyifxm;í Next udka½G;cs,fyg/ yHk(430)/
308/ Package udkrdrdxnfhvdkonfhvrf;aMumif;üxnfh&eftcGifhta&;&½Sdrnfh Dia-
log Box ay:vmrnf/ yHk(431)/
yHk(428)
yHk(429)
yHk(430)
uGefysLwmvufpJG 384
309/ tqdkyg Dialog Box wGifyif Folder udkajymif;í Next udka½G;cs,fyg/ yHk(432)/
310/ DAO Driver rsm;udka½G;cs,f&eftajctaeay;onfh Dialog Box ay:vmygu zdkiftm;vHk;udka½G;cs,fNyD; Next udk Click ESdyf&rnf/ yHk(433)/
yHk(430)
yHk(431)
yHk(432)
385 Microsoft Visual Basic 6.0
311/ Folder vrf;aMumif;topfa½G;cs,fojzifh aysmufaeonfh *.dll zdkifrsm;pm&if;udkjyaevdrfhrnf/ rnfodkYyifjzpfap OK udk Click ESdyf&rnfjzpfonf/ yHk(434)/
312/ Out-of-Date Dependency Information Dialog Box xyfrHay:vmrnf/OK udkom Click ESdyf&rnfjzpfonf/ yHk(435)/
yHk(433)
yHk(434)
uGefysLwmvufpJG 386
313/ rdrdwnfaqmufrnfh Application Package wGif yg0ifonfh *.dll zdkifrsm;udkCheck Box jzifh Mark vkyfxm;onf/ ra½G;cs,fvdkygu Uncheck jyKvkyfEdkifonf/tm;vHk;a½G;cs,fxm;ojzifh Next Command Button udkoma½G;cs,fyg/ yHk(436)/
314/ Cab File wnfaqmuf&eftcGifhta&;ay;onfh Dialog Box wpfckay:vmrnf/ tqdkyg Dialog Box wGif Single cab File wnfaqmufygu cab File wpfzdkifwnf;omwnfaqmufNyD; Disk Space rsm;vdrfhrnf/ Multiple cabs Option Button udka½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
yHk(435)
yHk(436)
387 Microsoft Visual Basic 6.0
jzpfay:vmaom cab File rsm;onf 1.44 MB xufrausmfapbJ cab File rsm;wpfzdkifxufrujzpfvmayrnf/ 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)/
315/ Installation Title udkowfrSwf&ef Dialog Box xyfrHay:vmrnf/ Instal-
lation title tm;rdrdpdwfBuKdufowfrSwfyg/ Oyrm - Result of the Students [kjyifqifjznfhpGufí Next udka½G;cs,f&rnf/ yHk(438)/
316/ Package and Deployment Wizard - Start Menu Items Dialog Box
ay:vmrnf/ Next udka½G;cs,fyg/ yHk(439)/
yHk(437)
yHk(438)
uGefysLwmvufpJG 388
317/ Package and Deployment Wizard - Install Locations Dialog Box
ay:vmrnf/ Next udka½G;cs,fyg/ yHk(440)/
318/ Package and Deployment Wizard - Shared Files Dialog Box ay:vmrnf/ Shared Files rsm;udk Check jyKvkyfí Next udka½G;cs,fyg/ yHk(441)/
yHk(439)
yHk(440)
389 Microsoft Visual Basic 6.0
319/ Package and Deployment Wizard - Finished! Dialog Box ay:vmrnf/ Finish udka½G;cs,fyg/ yHk(442)/
320/ Packaging Report Dialog Box xyfrHay:vmrnf/ Save Report Com-
mand Button udka½G;cs,fyg/ yHk(443)/
yHk(441)
yHk(442)
uGefysLwmvufpJG 390
321/ Save Report Dialog Box xyfrHay:vmrnf/ Save in: List Box wGifvrf;aMumif;ajymif;vdkyguajymif;NyD; Text File udkodrf;Edkifayonf/ yHk(444)/
322/ c:\My Documents\Package odkYvrf;aMumif;ajymif;yg/ xdkYaemuf Save
Command Button udka½G;cs,fyg/ yHk(445)/
323/ yHk(443)ygtwdkif; Dialog Box xyfrHay:vmrnf/ a½G;cs,fyg/ yHk(446)/ Close
Command Button udka½G;cs,fyg/
yHk(443)
yHk(444)
yHk(445)
391 Microsoft Visual Basic 6.0
yHk(446)
yHk(447)
324/ yHk(447)ygtwdkif; Package and Deployment Wizard Dialog Box xyfrHay:vmrnf/ Close Command Button udka½G;cs,fyg/ rlvy½dk*&rfodkYomjyefa&mufoGm;rnf/
325/ Application Package tm; C:\My Documents\Package xJwGifvrf;aMumif;ay;xm;ojzifh uGefysLwm Desktop ay:wGif½Sdaeonfh Icon wpfckjzpfaomMy Computer rS Munfhygu yHk(448)ygtwdkif;jrifawGUEdkifygonf/
uGefysLwmvufpJG 392
326/ tjcm;uGefysLwmpufwpfvHk;odkY Install jyKvkyfvdkygu 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;wGifvnf; Install vkyfNyD;ygu Run í&Edkifayonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(447)
393 Microsoft Visual Basic 6.0
tjcm;uGefysLwmrsm;odkY jyefvnf Install jyKvkyfjcif;327/ yHk(447)wGifawGUjrifae&aom zdkifrsm;udk Compact Disc (CD) jzifhaomfvnf;aumif;? Diskette jzifhaomfvnf;aumif;ul;,lí tjcm;uGefysLwmpufwpfvHk;odkY Install
jyKvkyfEdkifayonf/ tqdkygzdkifrsm;xJrS Setup.exe udk Double Click ESdyfyg/ yHk(448)ygtwdkif;jrifawGU&rnf/ OK Command Button udka½G;cs,f&rnf/
328/ aemufxyf Dialog Box wpfckxyfrHay:vmrnf/ yHk(449)/
yHk(448)
uGefysLwmvufpJG 394
329/ uGefysLwmyHkygaom Command Button tm;a½G;cs,fygu C:\Program
Files\ Project1 xJwGif Install jyKvkyfrnfjzpfNyD;tjcm;vrf;aMumif;ajymif;vJí Install
vkyfvdkygu Change Directory udka½G;írdrdESpfouf&mvrf;aMumif;ajymif; Install jyKvkyfEdkifayonf/ xdkYaMumifh uGefysLwmyHkygaom Command Button tm;a½G;cs,fyg/ yHk(450)ygDialog Box wpfckxyfrHay:vmrnf/
yHk(449)
395 Microsoft Visual Basic 6.0
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:vmyguOK udk Click vkyf&efjzpfygonf/
yHk(450)
yHk(451)
uGefysLwmvufpJG 396
331/ y½dk*&rfrsm;onf uGefysLwmxJwGif C:\Program Files\Project1 vrf;aMumif;atmufodkYa&muf½SdoGm;onfudk My Computer Short Icon tqifhqifhudka½G;cs,fjcif;jzifhjrifawGU Edkifayonf/ yHk(452)/
332/ tqdkyg extest111.exe zdkifudk Run ygu y½dk*&rftouf0ifrnfjzpfonf/- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
InputBox a&;xHk;jzifh Password jyKvkyfjcif;333/ InputBox a&;xHk;jzifh Password jyKvkyf&eftwGuf yHk(453)wGifazmfjyxm;onfhForm zdkifwpfckudkwnfaqmufyg/
334/ yHk(453)yg Form zdkifwGif Label, Timer, Command Button wdkYjzifhwnfaqmufxm;NyD; vdktyfaom Properties rsm;udkjyifqifí y½dk*&rfrsm;udka&;om;&ayrnf/
yHk(452)
yHk(453)
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 MeEnd
End Sub
339/ Form Load twGuf-Private Sub Form_Load()
Dim Pw, Pworda = 1Pw = "Naing"Do While a <= 3
Pword = InputBox("Type in your password", "Password")
uGefysLwmvufpJG 398
If Pword <> Pw ThenMsgBox "Sorry, incorrect password"
ElseExit Sub
End Ifa = a + 1
LoopEnd
End Sub
340/ Timer1_Timer() twGuf-Private Sub Timer1_Timer()
Dim i As IntegerLabel1.BackColor = &H80000018Label1.ForeColor = blueLabel1.Caption = Now
End Sub
341/ txufygy½dk*&rfudk Run ygu yHk(454)ygtwdkif;jzpfay:vmrnf/
342/ InputBox a&;xHk;jzifha&;xm;ojzifh yxrOD;pGm Password awmif;onfh Input
Box ay:vmrnf/ rdrdrS Password udkrSefuefpGm½dkufESdyfEdkifygu wpfBudrfwnf;y½dk*&rfRun rnfjzpfonf/ Password (3)Budrf½dkufírSefuefrIr½Sdygu y½dk*&rfxJrSxGufoGm;vdrfhrnf/ 3 BudrftwGif; Password wpfcgr[kwfwpfcgrSefuefrI½SdrSom y½dk*&rf Run rnfjzpfonf/ yxrtBudrfwGif naing [k½dkufESdyfNyD; Enter odkYr[kwf OK Command Button
udka½G;cs,fyguyHk(455)ygtwdkif; Message Box wpfckjzifhjyrnfjzpfonf/ Enter odkYr[kwfOK Command Button udka½G;cs,fyg/
yHk(454)
399 Microsoft Visual Basic 6.0
343/ xdktcg Input Box aemufwpfzefjyefay:vmygu Password trSefudkjznfhpGufí Enter (odkYr[kwf) OK Command Button udka½G;cs,f&rnf/ yHk(456)/
344/ xdktcg y½dk*&rf Run vmrnfudk yHk(457)ygtwdkif;jrifawGUEdkifayonf/ y½dk*&rfrSxGufvdkygu Exit Command Button udka½G;cs,f&rnf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(455)
yHk(456)
yHk(457)
uGefysLwmvufpJG 400
omrefa&;xHk;jzifh Password jyKvkyfjcif;345/ omrefa&;xHk;jzifh Password jyKvkyf&eftwGuf yHk(458)wGifazmfjyxm;onfhForm zdkifwpfckudkwnfaqmufyg/
346/ yHk(458)yg Form zdkifwGif Label, Text Box, Command Button wdkYjzifhwnfaqmufxm;NyD; vdktyfaom Properties rsm;udkjyifqifí y½dk*&rfrsm;udka&;om;&ayrnf/
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
yHk(458)
401 Microsoft Visual Basic 6.0
349/ Run Command Button twGuf-Private Sub Command1_Click()
Dim Pw, PwordPw = "Naing"Pword = Text1.TextIf Pword <> Pw Then
Label2.Caption = "Sorry, incorrect password"ElseForm1.HideForm2.ShowEnd If
End Sub
350/ Form Load twGuf-Private Sub Form_Load()
If Text1.PasswordChar = "" ThenText1.PasswordChar = "*"
ElseText1.PasswordChar = ""
End IfEnd Sub
351/ Password rSefuefrI½Sdyguaemufxyf Form zdkifwpfckay:vmap&eftwGufxyfrH í Form zdkifwpfckwnfaqmuf&rnf/ yHk(459)/
yHk(459)
uGefysLwmvufpJG 402
352/ yHk(459)yg Form zdkifwGif Text Box, Timer, Command Button wdkYjzifhwnfaqmufxm;NyD; vdktyfaom Properties rsm;udkjyifqifí y½dk*&rfrsm;udka&;om;&ayrnf/
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 MeEnd
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/ yHk(458)yg Form zdkifudk Run ygu yHk(460)ygtwdkif;jzpfay:vmrnf/
361/ Text Box wGif rdrdtaejzifh jzpfEdkifonfxifonfh pmom;udk½dkuf&rnf/ Oyrm- Maung [k½dkufyg/ Text Box wGif Asterisk (*) rsm;omay:vmrnf/ Run Com-
mand Button udka½G;onfjzpfap? Alt+R udka½G;onfjzpfap Password rSefuefrI½SdrSomy½dk*&rf Run rnfjzpfonf/ Password rrSefuefygu yHk(461)ygtwdkif;jyovdrfhrnf/
yHk(460)
uGefysLwmvufpJG 404
362/ Password udkrSefuefpGm½dkufrxnfhEdkifygu y½dk*&rfxJodkYvHk;00ifcGifhjyKrnf r[kwfbJ Password rSefuefrI½SdrSom aemuf Form wpfckodkYqufvuftvkyfvkyfrnfjzpfygonf/xdkYaMumifhy½dk*&rfxJwGifowfrSwfxm;aom Password jzpfaom Naing udk jznfhpGufNyD;Enter odkYr[kwf OK Command Button udka½G;cs,fyg/ yHk(462)ygtwdkif;jzpfay:vmrnf/y½dk*&rfxJrSxGufvdkygu Exit Command Button udka½G;cs,fyg/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(461)
yHk(462)
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"> Welcometo 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"> 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-formated2. 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 textarea. 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 istext area. This is text area. This is text area. This is text area. This is textarea. 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 istext area. This is text area. This is text area. This is text area. This is textarea. 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 istext area. This is text area. This is text area. This is text area. This is textarea. 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 Paragraph1Paragraph1 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 Paragraph1Paragraph1 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 scriptfunction 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 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 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.valueb_str = document.Form1.Text2.valuea_int = cint(a_str)b_int = cint(b_str)c = 0c = a_int+b_intMsgBox "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  <INPUT TYPE="TEXT" NAME="P1"><br>
Equivalent Centigrade Degree <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:[email protected]">
<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> <br> <br> Sy s t e m V e r s i o n . . . . <font color=#00FF00>v2.5</font> <br> <br> L i f e S u p p o r t . . . .<font color=#00FF00>-ok</font> <br> <br> V i t a l 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">Activateyour 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 zdkifrsm;tm; y½dk*&rfjzifhqJGwif&eftwGuf Form zdkifwpfckudkwnfaqmuf&rnf/
399/ yHk(463)yg Form zdkifwGif Timer, Label, Progress Bar wdkYjzifh wnfaqmufxm;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
yHk(463)
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 IntegerFor n1 = 1 To 1000
Form1.Caption = "Processing Step " & Trim$(CStr(n1)) & " of 1000"ProgressBar1 = n1
Next n1Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE
c:\html_notes\index.htm", 1)End
End Sub
uGefysLwmvufpJG 434
404/ yHk(463)yg Form zdkifudk Run ygu yHk(464)ygtwdkif;jzpfay:vmrnf/
405/ acwåcP(Oyrm-5 puúefYcefY)Mumjrifhygu yHk(465)ygtwdkif;y½dk*&rf Run rnfjzpfonf/ Time Interval tm; 5000 ay;xm;aomaMumifhjzpfonf/
406/ Progress Bar wef;jynfhoGm;ygu yHk(466)ygtwdkif; Microsoft Internet Ex-
plorer ay:vmNyD; HTML jzifha&;om;xm;onfh y½dk*&rfrsm;udk toHk;csí&NyDjzpfonf/tu,fí Microsoft Internet Explorer rSxGufvdkygu Close Button udkESdyf&rnf/
yHk(464)
yHk(465)
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;udkqJGwifvdkygu atmufygtwdkif; Form wpfckudkwnfaqmuf&rnf/ 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
yHk(467)
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 MyAppIDMyAppID = Shell("C:\PM65\PM65.EXE", 1)
End Sub
12/ Command5 - Command Button twGuf-Private Sub Command5_Click() Unload Me EndEnd 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 wdkYjzifhzefwD;xm;NyD; oufqdkif&m Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udka&;om;&rnf/
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 = >
yHk(468)
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 = 1If a1 > a2 Then Exit Suba1 = a1 + 1
441 Microsoft Visual Basic 6.0
Text1.Locked = TrueLoad Text(a1)b1 = Text(a1).Name 'Text(a1).Name="Text"b2 = Text(a1).Index 'Text(a1).Index = a1+1b1 = "Text"b2 = a1 + 1Text(a1).Locked = TrueText(a1).Top = Text(a1 - 1).Top + 400Text(a1).Left = Text(a1).Left - 400Text(a1).Visible = TruePrint Text(a1), Text(a1).Name, Text(a1).IndexText(a1) = Text(a1)
End Sub
11/ Exit - Command2 Button twGuf-Private Sub Command2_Click()
Unload Me 'Unload this formEnd
End Sub
12/ txufygy½dk*&rfudk Run ygu yHk(469)ygtwdkif;jrifawGU&rnfjzpfygonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(469)
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 wdkYjzifhzefwD;xm;NyD; oufqdkif&m Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udk a&;om;&rnf/
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 = >
yHk(470)
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 = TrueIf num1 = 0 Then num1 = 1If num1 > n Then Exit Subnum1 = num1 + 1Load Text(num1)b1 = Text(num1).Name 'Text(num1).Name="Text"b2 = Text(num1).Index 'Text(num1).Index = num1+1Text(num1).Locked = TrueText(num1).Top = Text(num1 - 1).Top + 400Text(num1).Left = Text(num1).Left - 400Text(num1).Visible = TruePrint Text(num1), Text(num1).Name, Text(num1).Indexi = Text(num1).Index - 1k(i) = Text(num1)Print k(i), i
End Sub
24/ Exchange Sort - Command2 Button twGuf-Private Sub Command2_Click()
ClsFor i = 1 To n - 1
For j = 1 To n - 1If k(j) <= k(j + 1) Then GoTo 100t = k(j): k(j) = k(j + 1): k(j + 1) = t
100 Next jNext iFor 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 MeEnd
End Sub
26/ txufyg y½dk*&rfudk Run ygu yHk(471)ygtwdkif;jrifawGU&rnfjzpfygonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(471)
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 wdkYjzifhzefwD;xm;NyD; oufqdkif&m Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udk a&;om;&rnf/
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 = >
yHk(472)
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 = TrueIf num1 = 0 Then num1 = 1If num1 > n Then Exit Subnum1 = num1 + 1Load Text(num1)b1 = Text(num1).Name 'Text(num1).Name="Text"b2 = Text(num1).Index 'Text(num1).Index = num1+1Text(num1).Locked = TrueText(num1).Top = Text(num1 - 1).Top + 400Text(num1).Left = Text(num1).Left - 400Text(num1).Visible = TruePrint Text(num1), Text(num1).Name, Text(num1).Indexi = Text(num1).Index - 1k(i) = Text(num1)Print k(i), iText(num1) = Text(num1)
End Sub
38/ Counting Sort - Command2 Button twGuf-Private Sub Command2_Click()
ClsFor i = 1 To n
kount(i) = 1NextFor i = 2 To n
For j = 1 To i - 1If k(i) > k(j) Then
kount(i) = kount(i) + 1Else
kount(j) = kount(j) + 1End If
Next jNext i
449 Microsoft Visual Basic 6.0
For i = 1 To nf(kount(i)) = k(i)
NextFor x = 1 To n
Print f(x)Next
End Sub
39/ Exit - Command3 Button twGuf-Private Sub Command3_Click()
Unload MeEnd
End Sub
40/ txufyg y½dk*&rfudk Run ygu yHk(473)ygtwdkif;jrifawGU&rnfjzpfygonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(473)
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 wdkYjzifhzefwD;xm;NyD; oufqdkif&m Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udka&;om;&rnf/
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 = >
yHk(474)
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 = TrueIf num1 = 0 Then num1 = 1If num1 > n Then Exit Subnum1 = num1 + 1Load Text(num1)b1 = Text(num1).Name 'Text(num1).Name="Text"b2 = Text(num1).Index 'Text(num1).Index = num1+1Text(num1).Locked = TrueText(num1).Top = Text(num1 - 1).Top + 400Text(num1).Left = Text(num1).Left - 400Text(num1).Visible = TruePrint Text(num1), Text(num1).Name, Text(num1).Indexi = Text(num1).Index - 1k(i) = Text(num1)Print k(i), iText(num1) = Text(num1)
End Sub
52/ Insertion Sort - Command2 Button twGuf-Private Sub Command2_Click()
ClsFor i = 2 To n
current = k(i)j = i - 1
70 If j < 1 Or current >= k(j) Then GoTo 100k(j + 1) = k(j)j = j - 1GoTo 70
100 k(j + 1) = currentNext iDo 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 nPrint k(x)
NextEnd Sub
53/ Exit - Command3 Button twGuf-Private Sub Command3_Click()
Unload MeEnd
End Sub
54/ txufyg y½dk*&rfudk Run ygu yHk(475)ygtwdkif;jrifawGU&rnfjzpfygonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(475)
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 wdkYjzifhzefwD;xm;NyD; oufqdkif&m Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif atmufygy½dk*&rfrsm;udka&;om;&rnf/
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 = >
yHk(476)
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 = TrueIf num1 = 0 Then num1 = 1If num1 > n Then Exit Subnum1 = num1 + 1Load Text(num1)b1 = Text(num1).Name 'Text(num1).Name="Text"b2 = Text(num1).Index 'Text(num1).Index = num1+1Text(num1).Locked = TrueText(num1).Top = Text(num1 - 1).Top + 400Text(num1).Left = Text(num1).Left - 400Text(num1).Visible = TruePrint Text(num1), Text(num1).Name, Text(num1).Indexi = Text(num1).Index - 1k(i) = Text(num1)Print k(i), iText(num1) = Text(num1)
End Sub
66/ Selection Sort with Exchange - Command2 Button twGuf-Private Sub Command2_Click()
ClsFor i = 1 To n - 1
mini = k(i): idx = iFor j = i + 1 To n
If k(j) >= mini Then GoTo 10mini = k(j): idx = j
10 Next jk(idx) = k(i): k(i) = mini
Next iFor i = 1 To n
Print k(i)Next
457 Microsoft Visual Basic 6.0
For i = 1 To nPrint k(i)
NextEnd Sub
67/ Exit - Command3 Button twGuf-Private Sub Command3_Click()
Unload MeEnd
End Sub
68/ txufyg y½dk*&rfudk Run ygu yHk(477)ygtwdkif;jrifawGU&rnfjzpfygonf/
- - - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - - - - - - -
yHk(477)