vb6 mm

Page 1

Home

u

Microsoft Visual Basic 6.0

uuuGef

rmwdum trSwfpOf

taMumif;t&m

pmrsufESm

tcef; ( 1 ) 1/

Introduction pum;csD;

1

2/

Visual Basic 6.0 pwifzGifhjcif;

1

3/

Creating an Application y½dk*&rfwpfckudkpwiftajcwnfjcif;

2

4/

Create the interface tjyeftvSefqufoG,fcsufrsm;udk

BudKwifpOf;pm;jcif;

3

5/

Set Properties *kPfowådrsm;udkjyifqifjcif;

6

6/

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

9

7/

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

18

8/

Prime Number udk½Smjcif;

23

tcef; ( 2 ) 9/ 10/

Menu wnfaqmufjcif; Pulldown Menu wpfckjzpfaom Test Buttons udka½G;ygu

jzpfvmrnfh Program udk a&;om;jcif; 11/

25 31

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

33

12/

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

34

13/

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


c

Microsoft Visual Basic 6.0

trSwfpOf 14/

taMumif;t&m

pmrsufESm

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

15/

uuuGef

42

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

44

16/

Scroll Bars (Pulldown Menu) twGuf Program a&;om;jcif; 46

17/

Menu Bar aemufwpfckxyfrHjyKvkyfjcif;

48

tcef; ( 3 ) 18/

Graphic rsm;udk Windows yHkpHtwdkif;½SmazGjcif;

58

19/

Timer jzifhtcsdefudkzefwD;jcif;

62

20/

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

65

tcef; ( 4 ) 21/

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

70

22/

Visual Basic 6.0 wGif ODBC Data Sources qJGwifjcif;

77

23/

Data Form Wizard wnfaqmufjcif;

78

24/

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

85


*

Microsoft Visual Basic 6.0

trSwfpOf

taMumif;t&m

uuuGef

pmrsufESm

tcef; ( 5 ) 25/

String ESifhqdkifaomudpö&yfrsm;

91

26/

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

93

27/

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

95

28/

Astrisk rsm;zefwD;jcif;

97

29/

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

98

30/

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

100

tcef; ( 6 ) 31/

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;

104

32/

AP udef;pOfwef;udk y½dk*&rfa&;om;jcif;

105

33/

GP udef;pOfwef;udk y½dk*&rfa&;om;jcif;

107

34/

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

108

35/

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

109

36/

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

110

37/

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

111


C

Microsoft Visual Basic 6.0

trSwfpOf

taMumif;t&m

uuuGef

pmrsufESm

tcef; ( 7 ) 38/

Access 2002 ½Sd Database File tm; Visual Basic 6.0 ESifh Update jyKvkyfjcif;

113

39/

DataGrid jzifh Update jyKvkyfjcif;

119

40/

Access 2002 Database File wGif Field topfxyfxnfhí

41/

Update vkyfjcif;

126

Access 2002 Database File ½Sd Query File tm;ac:oHk;jcif;

130

tcef; ( 8 ) 42/

Data Types rsm;\*kPfowådrsm;

135

43/

erlemy½dk*&rfrsm;

136

44/

Toolbox wGifyg0ifaom Icon rsm;ESifherlemy½dk*&rfrsm;

149

45/

Microsoft Windows Common Controls

wGifyg0ifaom Icon rsm;

205

46/

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

47/

Execute File udk y½dk*&rfjzifhvSrf;ac:toHk;jyKjcif;

224

48/

jr§m;rsm;udkywfjcmvnfvSnfhonfhy½dk*&rfudka&;jcif;

226


i

Microsoft Visual Basic 6.0

trSwfpOf

taMumif;t&m

uuuGef

pmrsufESm

tcef; ( 9 ) 49/

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

50/

Access 2002 ½Sd Database File wpfckxJrS Table File ESpfcktm; Updating jyKvkyfjcif;

51/

246

Access 2002 ½Sd Database File twGif;rS Table File rsm;tm; Form wpfckjzifh Append jyKvkyfjcif;

54/

242

Access 2002 ½Sd Database File trsm;pkxJrS Table File trsm;pktm; Form wpfckjzifh zGifhjcif;

53/

235

Access 2002 ½Sd Database File wpfckxJrS Table File rsm;tm; Form wpfckjzifhzGifhjcif;

52/

229

252

Access 2002 ½Sd Database File twGif;rS Table File twGif;½Sd Record tm;½Smjcif;

255

tcef; ( 10 ) 55/

Microsoft Visual 6.0 jzifh,cifoHk; Access zdkifwnfaqmufjcif; 258

56/

,cifoHk; Access zdkifudk Data Report wnfaqmufí Report wnfaqmufjcif;

57/

274

,cifoHk; Access zdkifudk Form wnfaqmufí"gwfyHkrsm;Munfhjcif; 295


p

Microsoft Visual Basic 6.0

trSwfpOf

taMumif;t&m

uuuGef

pmrsufESm

58/

Toolbox xJwGif Crystal Report Smart Icon xnfhjcif;

302

59/

Crystal Report wnfaqmufjcif; (,cif Access File)

304

60/

Crystal Report wnfaqmufjcif; (Access File 2000 txuf) 316

61/

Crystal Report jzifh Graphic File ½dkufxkwfjcif;

62/

Access zdkifudk Crystal Report wnfaqmufí Print ½dkufxkwfjcif;

63/

329

Database File wpfcktwGif;½Sd Table zdkifESpfckudktoHk;jyKíuHprf;rJEIdufjcif;

64/

331

ODBC jzifhzefwD;xm;aom Access zdkifudk

touf? vkyfouf? yifpif,lrnfhESpfwGufjcif; 65/

321

358

Visual Basic 6.0 jzifhzefwD;xm;aom Access zdkifudk Printer jzifh½dkufxkwfjcif;

362

tcef; ( 11 ) 66/

Visual Basic 6.0 jzifh Program wpfcktm;a&;NyD; Execute File wnfaqmufjcif;

67/

375

Visual Basic 6.0 jzifh Program wpfcktm;a&;NyD; Package jyKvkyfjcif;

381

68/

tjcm;uGeyf sLwmrsm;odYk jyefvnf Install jyKvkyfjcif;

393

69/

InputBox a&;xHk;jzifh Password jyKvkyfjcif;

396

70/

omrefa&;xHk;jzifh Password jyKvkyfjcif;

400


q

Microsoft Visual Basic 6.0

trSwfpOf

taMumif;t&m

uuuGef

pmrsufESm

tcef; ( 12 ) 71/

Microsoft Internet Explore zdkifudkqJG,ltoHk;csjcif;

405

tcef; ( 13 ) 72/

Application Package rsm;udky½dk*&rfjzifhzGifhjcif;

436

tcef; ( 14 ) taxGaxG 73/

Multiple List Box rsm;zefwD;jcif;

439

74/

Exchange Sort udk Visual Basic jzifha&;om;jcif;

442

75/

Counting Sort udk Visual Basic jzifha&;om;jcif;

446

76/

Insertion Sort udk Visual Basic jzifha&;om;jcif;

450

77/

Selection Sort with Exchange udk Visual Basic jzifha&;om;jcif;

454


Contents Microsoft Visual Basic 6.0

1

uuuGef

tcef;(1) Introduction pum;cs;D Microsoft Visual Basic 6.0 onf Programming rsm;a&;om;&mwGif toH;k jyKaom Computer Language wpfcjk zpfygonf/ ,cifu GWBASIC, BASIC, BASICA, Yk w S pfqifh ,cktcgwGif Visual Basic 4.0, Visual Basic 5.0, Visual QBASIC wdr f oH;k jyKEikd af om Programming Language rsm;jzifh Basic 6.0 (Windows Mode) wGit a&;om;cJhMuygonf/ Visual rSm tjrifESifhoufqdkifaom[kt"dyÜg,f&NyD; BASIC rSm Beginners All Purpose Symbolic Instruction Code [kt"dygÜ ,f&ygonf/ Visual Basic 6.0 pwifzGifhjcif; Windows 95 ESihf txufue G yf sLwmpufwpfv;kH zGiv hf u kd af omtcg Task Bar ay:wGif Start udk Mouse jzifh Left Click ESdyf&rnf/ xdkYaemuf Program tm;a½G;cs,fyg/ Subk yfraH y:vmrnf/ xdk Sub-Menu xJrS Microsoft Visual Basic 6.0 Menu wpfcx tm;a½G;ygu Visual Basic 6.0 tm;pwiftoH;k jyK&eftqifoifjh zpfaernf/ Desktop nmzuftay:axmifw h iG f Microsoft Office Short Cut Bar ½Sad eygu 4if; Bar wef;xJ wGif Microsoft Visual Basic 6.0 Smart Icon jyyguvnf; Left Click ESyd jf cif;jzifv h nf; aumif;? uGeyf sLwm Desktop ay:wGif Microsoft Visual Basic 6.0 Short Cut Icon ½Sad eyguvnf; 4if; Short Cut Icon udk Double Click ESyd jf cif;jzifv h nf;aumif; ac:,l

toH;k jyKEikd af yonf/ aemufwpfenf;rSm Start ® Run udk Mouse Left Click vkyv f u kd yf gu yH(k 1)ygtwdik ;f Run Dialog Box ay:vmrnf/

yHk(1)


Contents Microsoft Visual Basic 6.0

2

uuuGef

Open nmzuf½dS List Box xJwi G f Cursor 0ifaevdrrhf nf/ xdt k cg Browse udak ½G;yg/ VB6.EXE File ½S& d mtqifq h ifo h 0Ykd ifNy;D OK udEk ydS yf gu Visual Basic 6.0 yGiv hf mrnf/

yHk(2)/

yHk(2) Creating an Application y½dk*&rfwpfckudkpwiftajcwnfjcif; yxrOD;pGm Visual Basic Programming jzifh zm&if;[du k rf S pifw*D &dwo f aYkd jymif;vJ aomy½d*k &rfypk mä ukad &;om;&mwGif zm&if;[du k rf S pifw*D &dwo f aYkd jymif;vJaom Formula udo k ½d &dS rnf/ Oyrm - C = 5/9 * (F-32)

y½d*k &rfwpfcu k akd &;om;&mwGif tqif(h 3)qif½h o dS nf/ 4if;wdrYk mS 1. Create the interface 2. Set Properties 3. Write Code


Contents Microsoft Visual Basic 6.0

uuuGef

3

Create the interface tjyeftvSefqufoG,fcsufrsm;udkBudKwifpOf;pm;jcif; yxrOD;pGm Project topfwpfcu k zkd efw;D &rnf/ xdaYk Mumifh Menu Bar wGi½f adS om File udka½G;yg/ Pulldown Menu (or) Dropdown Menu wpfcak y:vmrnf/ 4if;xJrS New Project udka½G;&rnf/ yHk(3)/

yHk(3)

xdt k cg New Project Dialog Box wpfckay:vmNyD; yHkrSeftm;jzifh Standard EXE Smart Icon a½G;cs,fjcif;cHae&ygu OK udka½G;cs,f&ygrnf/ ykH(4)/


Contents Microsoft Visual Basic 6.0

4

uuuGef

yHk(4)

zm&if;[dkufrS pifwD*&dwfodkYajymif;vJrnfh y½dk*&rfa&;om;&ef Form1 qdo k nfh Form yHkpHwpfckay:vmrnf/ yHk(5)/

yHk(5)


Contents Microsoft Visual Basic 6.0

uuuGef

5

4if; Form yHkpHwGif Text, Memory Variable rsm;zefw;D &eftwGuf Visual Basic wGit f qifoifyh g½Sad eaom Toolbox udak c:,l&rnfjzpfygonf/ Toolbox udrk awGUygu Menu Bar ½Sd View rSwqifha½G;yg/ yHk(6)/ xdktcg Toolbox ay:vmayrnf/ yHk(7)/

yHk(7) yHk(6)

Icon udt k oH;k jyKí Fahrenheit Degree, Centigrade Degree rsm;udk Form xJwi G af &;om;&rnf/ yH(k 8)/

yHk(8)


Contents Microsoft Visual Basic 6.0

6

uuuGef

þuJo h Ykd Fahrenheit Degree, Centigrade rsm;udk zefw;D &mwGif Form1 xJoYkd Label f g&ef/ xdt k cg Form1 xJwiG f yH(k 9)ygyHpk t H wdik ;f Icon udka½G;í Drag and Drop vkyy jzpfaernf/

yHk(9)

Set Properties *kPfowÅdrsm;udkjyifqifjcif; Label [kazmfjyonfh Text Frame udkjrifawGU&rnfjzpfNyD; 4if; Text Frame ay:rS Mouse Right Click udE k ydS yf gu Short Cut Menu wpfcak y:vmrnf/ yH(k 10)/

yHk(10)


Contents Microsoft Visual Basic 6.0

uuuGef

7

4if; Short Cut Menu \atmufq;kH jzpfaom Properties udak ½G;yg/ xdt k cg Lakd af om Properties udk yH(k 11)ygtwdik ;f jrifawGU&rnf/ bel1 ESihf oufqi

yHk(11)

yHk(11)yg Properties - Label1 xJ½dS Label1 Label wGiyf g0ifaomtcsurf sm;udk atmufygtwdik ;f jyifqif&rnf AutoSize BackStyle Caption Font

-

True 0 - Transparant Fahrenheit Degree = = = > Font Size - 12, Font Style - Bold [kjyifqifjznfph u G Nf y;D Properties \ Close Button udak ½G;&rnfjzpfonf/ xdek nf;wl Centigrade Degree = = = > udv k nf; txufygtwdik ;f zefw;D &rnf/ xdaYk emuf Keyboard rS ocsmF qdik &f mude;f *Pef;rsm;½du k x f nf&h ef Text Box Icon jzifh Fahrenheit Degree = = = > \nmzufwi G x f yfrzH efw;D &ef/ xdaYk emuf Right Click xyfrEH ydS yf g&ef/ xdt k cg Short Cut Menu wpfcx k yfraH y:vmrnf/ yH(k 12)/


Contents Microsoft Visual Basic 6.0

8

uuuGef

yHk(12)

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

yHk(13)

Text1 TextBox Properties wGiaf tmufygwdu Yk jkd yifqif&efFont Font Size - 12, Font Style - Bold Text Empty [kjyifqifjznfph u G Nf y;D Properties \ Close Button udk Left Click vkyyf g/ xdt k cg Text1 TextBox Properties ydwo f mG ;vdrrhf nf/ xdek nf;wl Text2 udv k nf; Text1 enf;wl


Contents Microsoft Visual Basic 6.0

uuuGef

9

zefwD;xm;&rnf/ yHk(14)/ Text1 rSm zm&if;[du k 'f *D &DtwGujf zpfí Text2 rSm pifw*D &dwf 'D*&DtwGujf zpfygonf/

yHk(14)

Write Code y½dk*&rfa&;jcif; Fahrenheit Degree ½dkufoGif;&efjzpfaom Text Box ü*Pef;wpfck½dkufNyD; <Enk ufqikd &f m Text Box üazmfjyrnfjzpfonf/ ter> udkESdyfyg/ Centigrade Degree udo Centigrade Degree ½du k o f iG ;f &efjzpfaom Text Box ü*Pef;wpfck½dkufNyD; <Enter> udkESdyfygu Fahrenheit Degree udkoufqdkif&m Text Box ütjyeftvSefazmfjyrnf jzpfonf/ þuJo h jYkd yKvyk í f &Edik af p&ef Text1, Text2 TextBox wdw Yk iG f View Code (or) Program rsm;a&;om;&rnfjzpfonf/ Program a&;om;&mü Text1 Box wGif Double Click ESy d &f rnf/ xdt k cg Program a&;om;&eftqifoift h ajctaeay;vmrnf/

yHk(15)/

yHk(15)


Contents Microsoft Visual Basic 6.0

10

uuuGef

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/ xdaYk emuf Private Sub Text1_KeyPress(KeyAscii As Integer) ESifh End Sub tMum;wGif atmufyg Program udka&;om;&efjzpfonf/ yHk(16)/

yHk(16)

xdek nf;wl Text2 Text Box udk Double Click ESyd í f Private Sub Text2_Change ESifh End Sub ay:vmygu Procedure List Box udk Change tpm; KeyPress [k ajymif;&rnf/ xdaYk emuf Private Sub Test2_KeyPress(KeyAscii As Integer) ESifh End Sub tMum;wGif atmufyg Program udka&;om;&efjzpfonf/ yHk(17)/

yHk(17)

4if;zdik u f kd odr;f vdyk gu Menu Bar ½Sd File udak ½G;Ny;D Pulldown Menu wGiyf g0ifaom Save Project udak ½G;&efjzpfonf/ yH(k 18)? xdt k cg Save File as Dialog Box ay:vm rnf/ File Name List Box wGif extest001 [ka&;Ny;D Save udk Mouse Left Click vkyf&rnf/ yHk(19)/


Contents Microsoft Visual Basic 6.0

uuuGef

11

yHk(18)

yHk(19)

xdt k cg Save Project As Dialog Box ay:vmNyD; File Name List Box wGif extest1 [ka&;NyD; Mouse Left Click vky& f rnf/ yH(k 20)/ yxrodr;f aomzdik rf mS Form d trnfjzifo h rd ;f aomzdik rf mS Visual Basic Project File, Extension rSm .frm jzpfNy;D 'kw, File, Extension rSm .Vbp jzpfygonf/


Contents Microsoft Visual Basic 6.0

uuuGef

12

yHk(20)

xdt k cg Project - Project Dialog Box wGif Project1(extest001.vbp) ESihf Form1 k ;f jzpfay:vmayrnf/ (extest001.frm) [líyH(k 21)ygtwdi

yHk(21)

udk Click vkyyf gu extest001 yHkpHay:vmrnfjzpfNyD; 4if; Form udyk w d v f u kd yf gu Close Button udak ½G;&rnf/ yH(k 22)/ udk Click vkyyf gu Program a&;om;xm;onfrsm;udak wGU½S& d rnf/ yH(k 23)/


Contents Microsoft Visual Basic 6.0

uuuGef

13

yHk(22)

yHk(23)

txufyg Project File jzpfaom extest001 udk Run vdyk gu Menu Bar ½Sd Run udak ½G;yg/ xdaYk emuf Start udak ½G;yg/ yH(k 24)? (odrYk [kw)f Short Cut Key (or) Short k ydS í f vnf;&Edik af yonf/ (odrYk [kw)f Hand Key taejzifh Function Key jzpfaom F5 udE Menu Bar atmuf½dS Standard Toolbar rS Icon udk Left Click ESdyfjcif;jzifh vnf;&Edik af yonf/ xdt k cg yH(k 25)ygtwdik ;f Text Box xJwiG f Cursor tqifoifah &muf ½Sad ernf/

yHk(24)


Contents Microsoft Visual Basic 6.0

uuuGef

14

yHk(25)

zm&if;[dkuf'D*&DudkxnfhNyD; <Enter> ESdyfygu pifwD*&dwf'D*&DtajcwGufay;rnf/ pifw*D &dw'f *D &Dux kd nfNh y;D <Enter> ESyd yf guvnf; zm&if;[du k 'f *D &Duw kd u G af y;rnf/ rdrd BuKu d Ef pS o f uf&m Text Box ud*k Pef;½du k x f nfNh y;D <Enter> ESyd Ef ikd o f nft h cGit hf a&;½So d nf/ 4if; Form tm;ydwv f u kd yf gu Form1 \nmzuftay:axmifw h iG ½f adS om Close Button udak ½G;&rnf/ Visual Basic 6.0 xJrS xGuv f ykd gu Menu Bar ½Sd File udka½G;NyD; Pulldown k cg Microsoft Visual Basic Menu \atmufq;kH jzpfaom Exit udak ½G;&ygrnf/ xdt Dialog Box wpfcak y:vmrnf/ Yes udak ½G;ygu aemufq;kH Current Project, Form Yk o kd rd ;f oGm;Ny;D Microsoft Visual Basic rSxu G o f mG ;ayrnf/ No udak ½G;ygu File wdu rodr;f bJxu G o f mG ;ayrnf/ Cancel udak ½G;ygu Microsoft Visual Basic 6.0 rSrxGuf bJ,ciftwdik ;f tvkyv f yk Ef ikd rf nfjzpfygonf/ yH(k 26)/

yHk(26)


Contents Microsoft Visual Basic 6.0

15

uuuGef

½SdNyD;om; extest001 File udkzGifhvdkygu Menu Bar ½Sd File udka½G;yg/ xdktcg Pulldown Menu ay:vmrnf/ 4if;rS udak ½G;yg/ xdt k cg Open Project Dialog Box ay:vmNyD; 4if;rS extest001.vbp udak ½G;í Open udk Click ESdyf&efjzpfonf/ yHk(27)/

yHk(27)

odrYk [kwf extest001 File udzk iG v hf ykd gu Menu Bar ½Sd File udka½G;yg/ Exit tay:½Sd Recent File xJwi G f extest001.vbp udak ½G;yguvnf; yGiv hf mrnfjzpfonf/ yH(k 28)/


Contents Microsoft Visual Basic 6.0

uuuGef

16

yHk(28)

þuJo h Ykd zdik zf iG v hf u kd af omtcg wcgw&H Project File rawGU½Syd gu Menu Bar ½Sd View udka½G;yg/ 4if;rS Pulldown Menu wpfcjk zpfaom Project Explorer udka½G;yg/ odrYk [kwf Short Cut Key jzpfonfh Ctrl+R udkESdyfyg/ yHk(29)/


Contents Microsoft Visual Basic 6.0

uuuGef

17

yHk(29)

xdt k cg yH(k 30)wGiaf zmfjyxm;onft h wdik ;f extest001 Dialog Box ay:vmayrnf/ , wdu Yk kd toH;k jyKí Project File udkjyefvnfjyKjyifodrf;Edkif ayonf/

yHk(30)


Contents Microsoft Visual Basic 6.0

18

uuuGef

Factorial ½Smonfh y½dk*&rfa&;jcif; atmufygyH(k 31)ygtwdik ;f Visual Basic wGizf efw;D xm;&rnf/

yHk(31)

Title Bar wGif ½kyy f EkH iS w hf uG Factorial pmom;xnfo h iG ;f &mwGif Properties ü Form1 Yk jkd yifqif&ef/ yH(k 32)/ Form udak ½G;yg/ xdaYk emufatmufygwdu

yHk(32)


Contents Microsoft Visual Basic 6.0 Caption Icon

-

19

uuuGef

Factorial C:\Program Files\Microsoft Visual Studio\Common\ S ifah wmf&m½kyyf u kH akd ½G;xnfjh cif;jzpf Graphics\Icon\Misc xJro

onf/ Run ESifh Exit onf Command Button rsm;jzpfMuNy;D 4if;wd\ Yk oufqikd &f m Propk nf; atmufygtwdik ;f pDrx H m;&rnf? Run Command Button wGif erties rsm;udv Caption &Run Font MS Sans Serif, Font Style ® Bold, Font Size ® 10 Exit Command Button wGif Caption E&xit Font MS Sans Serif, Font Style ® Bold, Font Size ® 10 Exit Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command2_Click() Unload Me End End Sub Run Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command1_Click() ' Write a program to find the factorial of a given integer: N! = 1*2*3*4*5*...*N Cls a = Text1 kount = 1: k = 1 Do While k < a + 1 kount = kount * k k = k +1 loop print "Requirement Answer = = = > ", kount Text2 = kount End Sub


Contents Microsoft Visual Basic 6.0

20

uuuGef

Factorial Program udak &;om;&mwGif Do ... Loop a&;xH;k udk odoifo h nf/ Do ... k ;f jzpfonf/ Loop a&;xH;k rSm atmufygtwdi 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

xyfcg xyfcgtvkyv f yk &f rnfu h pd rö sm;wGif txufyg Do ... Loop a&;xH;k udt k oH;k jyK onf/ xdt k cg Text1 Text Box xJwiG f Cursor 0ifaernfjzpfNyD; 4if;wGif *Pef;wpfck ck½dkufxnfh&rnf/ Oyrm - 4 [k½dkufNyD; Run Command Button udk Click vkyyf gu Private Sub Command1_Click() ESihf End Sub Mum;½Sd Command rsm;udw k pfaMumif; csi;f tvkyv f yk o f mG ;rnf/ Cls a&;xH;k rSm Form ay:wGit f jcm;udprö sm;a&;xm;ygu ½Si;f vif; ypf&efjzpfygonf/ a = Text1 rSm a xJwiG f 4 a&muf½v dS mrnf/ kount = 1 rSm kount xJ wGif 1 a&muf½v dS mrnf/ k = 1 rSm k xJwiG f 1 udx k nfx h m;rnf/ Do While k<a+1 rSm ,cktcsed w f iG f k \wefzdk;rSm 1 jzpfaernf/ a \wefzdk;rSm 4 jzpfaeNyD; 1 jzifhaygif;ygu 5 jzpfrnf/ 1 onf 5 xufi,faeojzifh qufvyk &f efjzpfonf/ xdaYk Mumifh k wefz;kd onf 5 xufi,faeoíqufvyk rf nfuakd jymjcif;jzpfonf/ k = kount * k rSm kount \wefz;kd rSm 1? k \wefzdk;rSm 1? 4if;ESpfckajr§mufygu 1 om&rnf/ Left Hand Side jzpfaom kount xJwiG f 1 a&muf½o dS mG ;rnf/ atmufwpfaMumif;qif;vmygu k \wefzdk;rSm 1? 1 jzifh aygif;aomaMumifh 2 &rnf/ 4if;wefz;kd udk Left Hand Side jzpfaom k xJwiG f 2 a&muf½dS oGm;rnf/ atmufwpfaMumif;jzpfaom Loop odq Yk ufrqif;bJ Do While k<a+1 odjYk yef wufNy;D Condition udpk pd pfrnf/ k \wefz;kd rSm ,cktcg 2 jzpfae rnf/ 2 onf 5 xuf i,faeojzifh atmufwpfaMumif;jzpfaom kount = kount * k odYk qif;vmrnf/ kount


Contents Microsoft Visual Basic 6.0

21

uuuGef

\wefzdk;onf 1 jzpfNyD; k wefzdk;rSm 2 jzpfaomaMumifh 2 ESifh 1 ajr§mufygu 2 &rnf/ 4if; wefzdk; kount xJa&mufoGm;rnf/ atmufwpfaMumif;qif;ygu k = k +1 jzpfomG ;ayrnf/ xHpk t H wdik ;f Do While k<a+1 odjYk yefwufNy;D Condition udpk pd pfayrnf/ k \wef z d k ; rS m ,ck t cg 3 jzpf a ernf / 3 onf 5 xuf i ,f a eojzif h atmufwpfaMumif;jzpfaom kount = kount * k odq Yk if;vmrnf/ kount \wefz;kd onf 2 jzpfNy;D k \wefz;kd rSm 3 jzpfvmaom aMumifh 2 ESihf 3 ajrm§ ufygu 6 &rnf/ 4if;wefz;kd tm; kount xJa&mufomG ;rnf/ atmuf wpfaMumif;quf qif;ygu k = k + 1 udak wGUrnf/ k \wefzdk;rSm 3 jzpfí 3 ESifh 1 udk aygif;ygu 4 &rnf/ k \wefzdk;rSm 4 jzpfoGm;ayrnf/ xH;k pHtwdik ;f Do While k<a+1 odjYk yefwufNy;D Condition udpk pd pfrnf/ k \wefzdk;rSm ,cktcg 4 jzpfaernf/ 4 onf 5 xufi,faeojzifh atmufwpfaMumif;jzpfaMumif; kount = kount * k odq Yk if;vmrnf/ kount \wefz;kd onf 6 jzpfNy;D k \wefz;kd rSm 4 jzpfaomaMumifh 6 ESihf 4 ajrm§ ufygu 24 &rnf/ 4if;wefz;kd kount xJa&mufomG ;rnf/ atmufwpfaMumif;qufqif;ygu k = k + 1 udak wGUrnf/ k \wefzdk;rSm 4 jzpfí 4 ESifh 1 udak ygif;ygu 5 &rnf/ k \wefz;kd rSm 5 jzpfomG ;ayrnf/ xH;k pHtwdik ;f Do While k pd pfrnf/ k \wefz;kd rSm ,cktcg 5 jzpfaernf/ 5 k<a+1 odjYk yefwufNy;D Condition udp onf 5 xufi,faeojzifh Condition rSm;oGm; ayrnf/ xdt k cg Do While ... Loop \ atmufwpfaMumif;jzpfaom Print "Requirement Answer = = = > ", kount odq Yk if;vmayrnf/ Form \b,fbufaxmifw h iG f "Requirement Answer = = = > pmom;ay:vmNyD ; 24 [k a zmf j yrnf / Text2 xJ w G i f v nf ; tajzjzpf a om 24 udkazmfjyaernfjzpfonf/ ykpäm2 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/ atmufazmfjyyg yH(k 33)ygtwdik ;f Visual Basic wGizf efw;D xm;yg&ef/

yHk(33)


Contents Microsoft Visual Basic 6.0

22

uuuGef

Exit Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command2_Click() Unload Me End End Sub Run Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command1_Click() a = 1: Check = True Do ' While Check = True If a Mod 2 = 1 And a Mod 3 = 2 And a Mod 5 = 4 And a Mod 7 = 6 Then Exit Do ' Exit Inner Loop Else a=a+1 End If Loop Until Check = False 'Exit Outer Loop Immediately Print "Requirement Answer = > ", a Text1 = a End Sub txufyg Program udk Run ygu tajzonf 209 &rnf/ 4if; Program udka&;&m wGif Mod (Modulus) Operator a&;xH;k udk odoifo h nf/ Syntax; result = number1 Mod number2 A = 7 Mod 4, A 速 3 A = 7 Mod 3, A 速 1 Mod onf Operator jzpfonf/


Contents Microsoft Visual Basic 6.0

23

uuuGef

Prime Number udk½Smjcif;

atmufygyH(k 34)ygtwdik ;f Visual Basic wGizf efw;D xm;&rnf yHk(34)

Exit Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command2_Click() Unload Me End End Sub Run Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command1_Click() 'To determine whether the given number is Prime Number Cls mp = Text1 mc = 2 Do While Not (mp Mod mc = 0 And mc <= mp) mc = mc + 1 Loop Print: Print Print "MP ", mp Print "MC ", mc If Text1 = mc Then Print Print mp, " is a Prime Number." Else Print Print mp, " does not Prime Number." End If End Sub


Contents Microsoft Visual Basic 6.0

24

uuuGef

tu,fírdrpd w d Bf uKu d *f Pef;ud½k u kd o f iG ;f Ny;D 2 ESihf rdr½d u kd o f iG ;f onfh *Pef;Mum; Prime f ½kd mS vdyk gu yH(k 35)ygtwdik ;f zefw;D wnfaqmuf&ef Number ta&twGuu

yHk(35)

Exit Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command2_Click() Unload Me End End Sub Run Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command1_Click() Cls d=1 pp = 2 zz = Val(Text1) Do While pp < zz mc = 2 Do While Not (pp Mod mc = 0 And mc <= pp) mc = mc + 1 Loop If mc = pp Then d=d+1 Print mc; End If pp = pp + 1 Loop Text2 = d - 1 End Sub ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

uuuGef

25

tcef;(2) Menu wnfaqmufjcif; Menu wnfaqmuf&mwGif Menu Bar rS Tools Menu udka½G;yg/ xdkYaemuf Pulldown Menu xJrS Menu Editor ... udka½G;yg/ yHk(36)/ xdktcg Menu Editor Dialog Box wpfcak y:vmrnf/ yH(k 37)/

yHk(36)

yHk(37)

Caption nmzuf½dS Box wGif &Options [ka&;&ef/ Name nmzuf½dS Box wGif Options [ktrnfowfrw S &f ef/ xdt k cg atmufzuf½dS List Box wGif yH(k 38)ygtwdik ;f

jzpfay:vmrnf/


Contents Microsoft Visual Basic 6.0

26

uuuGef

yHk(38)

txufygyH(k 38)wGif OK udk Mouse Left Click vkyyf gu yH(k 39)ygtwdik ;f jzpfay:vm rnf/ 4if;onf Menu Bar jzpfonf/

yHk(39)


Contents Microsoft Visual Basic 6.0

27

uuuGef

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

yHk(40)

xdt k cg yH(k 41)wGiaf zmfjyxm;ouJo h Ykd Test Buttons onf Pulldown Menu (or) Dropdown Menu wpfcjk zpfvmrnf/


Contents Microsoft Visual Basic 6.0

28

uuuGef

yHk(41)

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

yHk(42)


Contents Microsoft Visual Basic 6.0

uuuGef

29

Pulldown Menu wpfcjk zpfaom List Box udk Mouse Left Click ESy d yf gu aemuf xyf Sub-Menu wpfcak y:xGuaf pvdyk gu Menu Editor ... udkjyefac:í udka½G;yg/ xdkYaemuf udka½G;yg/ Caption List Box wGif N&umber, T&ext wdEYk iS hf Number List Box wGif Number, Text wdu Yk jkd znfph u G Nf y;D OK udk Mouse Left Click vkyyf gu yH(k 43)wGif jrif&onft h wdik ;f Pulldown Menu (or) Dropdown Menu rsm;

toD;oD;jzpfvmrnf/

yHk(43)

tqdkyg Pulldown Menu wpfckjzpfaom List Box onf Word Wrap and k gu Menu Bar ½Sd Autosize ESifh Check Box Mum;wGif ae&mjyefvnfajymif;a½TUvdy Tools udka½G;yg/ Dropdown Menu wpfcjk zpfaom Menu Editor ... udjk yefvnfa½G;yg/ ...&Check Box udak ½G;í Dropdown Arrow jzifah tmufq;kH udk a&mufatmifa½TU&ef/ xdek nf;wl ...&Number System udv k nf; atmufq;kH odaYk &mufatmifa½TUNy;D OK udk Click vkyjf cif;jzifh &½SE d ikd af yonf/ yH(k 44)? xdt k cg yH(k 45)ygtwdik ;f Menu ajymif;vJomG ;ay rnf/


Contents Microsoft Visual Basic 6.0

uuuGef

30

yHk(44)

yHk(45)

Form1 Menu xJrx S u G &f ef Command Button jzifh Exit udzk efw;D í xH;k pHtwdik ;f

y½dk*&rfa&;om;&rnf/ yHk(46)/ Private Sub Command1_Click() Unload Me End End Sub


Contents Microsoft Visual Basic 6.0

uuuGef

31

yHk(46)

Pulldown Menu wpfcjk zpfaom Test Buttons udak ½G;ygujzpfvmrnfh Program udk

a&;om;jcif; Pulldown Menu wpfcjk zpfaom Test Buttons udak ½G;ygu 4if;ESiv hf u kd avsmnDaxG jzpfap&ef Form wpfck Insert jyKvyk í f vdt k yfaomy½d*k &rfrsm;a&;om;&rnf/ Form wpfcu k kd Insert jyKvyk v f ykd gu Menu Bar ½Sd Project udka½G;yg/ xdkYaemuf Pulldown Menu jzpfaom Add Form udk a½G;&efjzpfonf/ yHk(47)/

yHk(47)


Contents Microsoft Visual Basic 6.0

uuuGef

32

Form2 jzpfay:vmygu yH(k 48)ygtwdi k ;f wnfaqmuf&efjzpfonf/

yHk(48)

Command Button wpfcjk zpfaom Change Signal wGif atmufygy½d* k &rfuakd &;om;

&rnfPrivate Sub Command1_Click() ChangeSignal End Sub

k &rfuakd &;om; Command Button aemufwpfcjk zpfaom Close wGif atmufygy½d* &rnfPrivate Sub Command2_Click() Form2.Hide Form1.Show End Sub Command1 wGiaf &;om;xm;aomy½d* k &rfrmS wdu k ½f u kd f Run aomy½d*k &rfjzpfojzifh

4if;y½d*k &rfukd qufvufa&;om;&ef vdt k yfygonf/ yH(k 49)/ Pulldown Menu wpfcjk zpfaom Test Button udk Click vkyy f g/ 4if;wGif Form2 udk vSr;f íac:aom y½d*k &rfuakd &;om;&rnf/ Private Sub TestButtons_Click() Form2.Show End Sub


Contents Microsoft Visual Basic 6.0

uuuGef

33

Form2 \ General wGiaf tmufygy½d* k &rfukd xyfraH &;om;&rnf -

yHk(49)

Word Wrap and Autosize (Pulldown Menu) twGuf Program a&;om;jcif; Pulldown Menu wpfcjk zpfaom Word Wrap and Autosize Button udak ½G;ygu 4if;ESiv hf u kd af vsmnDaxGjzpfap&ef aemufxyf Form wpfczk efw;D í vdt k yfaomy½d*k &rf

rsm;a&;om;&rnf/ yHk(50)/

yHk(50)

Form3 udak tmufygtwdi k ;f wnfaqmuf&rnf? yH(k 51)/

yHk(51)


Contents Microsoft Visual Basic 6.0

34

uuuGef

yH(k 51)yg Form wGif , ESihf wdu Yk o kd ;kH xm; Yk o kd wfrw S x f m;yg ygonf/ Check1 wGif Auto Size ESifh Check2 wGif Word Wrap wdu onf/ 4if;wdu Yk kd atmufygtwdik ;f y½d*k &rfrsm;a&;om;&rnf/ Private Sub Check1_Click() If Check1.Value = 1 Then Label1.AutoSize = True Else Label1.AutoSize = False Label1.Height = 300 Label1.Width = 2000 End If End Sub Private Sub Check2_Click() If Check2.Value = 1 Then Label1.WordWrap = True Label1.AutoSize = True Else Label1.WordWrap = False Label1.Height = 300 Label1.Width = 2000 End If End Sub Private Sub Command1_Click() Form3.Hide Form1.Show End Sub List Box (Pulldown Menu) twGuf Program a&;om;jcif; List Box udak ½G;vdu k yf gu Sub-Menu wpfckxyfrHay:vmrnf/ 4if;wdkYrSm Numhf wfoufaom Form wpfck ber, Text wdjYk zpfMuonf/ Number udak ½G;ygu Number ESiy

ay:&efESifh vdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(52)/


Contents Microsoft Visual Basic 6.0

35

uuuGef

yHk(52)

tqdyk g Form yHpk w H iG f tpDtpOfrsm;udk Run Edik &f eftwGuf atmufygtwdik ;f jyifqif &rnf/

yHk(53)

, , ESifh txufygyH(k 53)udzk efw;D &mwGif wdu Yk o kd ;kH xm;ygonf/ txufyg Form yHpk t H m; Run í&Edik af p&ef atmufyg y½dk*&rfrsm;udk a&;om;&rnfAdd Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command1_Click() List1.AddItem Text1.Text Text1.Text = ""


Contents Microsoft Visual Basic 6.0

36

Text1.SetFocus Label3.Caption=List1.ListCount End Sub Remove Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command2_Click() Dim Ind As Integer Ind = List1.ListIndex If Ind >= 0 Then List1.RemoveItem Ind Label3.Caption = List1.ListCount Else Beep End If Command2.Enabled = (List1.ListIndex <> -1) End Sub Clear Command Button wGiaf tmufyg Program udak &;om;&efPrivate Sub Command3_Click() List1.Clear Command2.Enabled = False Label3.Caption = List1.ListCount End Sub Close Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command4_Click() Unload Me End Sub List Box (Single Click) twGuf Private Sub List1_Click() Command2.Enabled = (List1.ListIndex <> -1) End Sub List Box (Double Click) twGuf Private Sub List1_DblClick() Command2.Value = True End Sub

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

37

Text1, Add Command Button wdt Yk wGuf Private Sub Text1_Change() Command1.Enabled = (Len(Text1.Text)>0) End Sub hf wfoufaom Form wpfcak y:&ef Form wpfcu k zkd efw;D Text udak ½G;ygu Text ESiy

ívdt k yfaomy½d*k &rfrsm;a&;om;&rnf/ yH(k 54)/

yHk(54)

txufygyH(k 54)udzk efw;D &mwGif , , ESifh wdu Yk o kd ;kH xm;ygonf/ txufyg Form yHpk w H iG f tpDtpOfrsm;udk Run Edik &f ef twGuf atmufygtwdik ;f y½d*k &rfrsm;udk a&;om;&rnf/ yH(k 55)/

yHk(55)


Contents Microsoft Visual Basic 6.0

38

Add Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command1_Click() List1.AddItem Text1.Text Text1.Text = "" Text1.SetFocus Label3.Caption=List1.ListCount End Sub Remove Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command2_Click() Dim Ind As Integer Ind = List1.ListIndex If Ind >= 0 Then List1.RemoveItem Ind Label3.Caption = List1.ListCount Else Beep End If Command2.Enabled = (List1.ListIndex <> -1) End Sub Clear Command Button wGiaf tmufyg Program udak &;om;&efPrivate Sub Command3_Click() List1.Clear Command2.Enabled = False Label3.Caption = List1.ListCount End Sub Close Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command4_Click() Unload Me End Sub List Box (Single Click) twGuf Private Sub List1_Click() Command2.Enabled = (List1.ListIndex <> -1) End Sub

uuuGef


Contents Microsoft Visual Basic 6.0

39

uuuGef

List Box (Double Click) twGuf Private Sub List1_DblClick() Command2.Value = True End Sub Yk wGuf Text1, Add Command Button wdt Private Sub Text1_Change() Command1.Enabled = (Len(Text1.Text)>0) End Sub Check Box (Pulldown Menu) twGuf Program a&;om;jcif; Pulldown Menu wpfcjk zpfaom Check Box udak ½G;ygu 4if;ESiv hf u kd af vsmnDaxGjzpf ap&ef aemufxyf Form wpfczk efw;D í vdt k yfaomy½d*k &rf rsm;a&;om;&rnf/ yH(k 56)/

yHk(56)

tqdyk g Form yHpk w H iG f tpDtpOfrsm;udk Run Edik &f ef twGuf atmufygtwdik ;f jyifqif& rnf/ yHk(57)/ , , ESifh wdu Yk kd oH;k xm;ygonf/


Contents Microsoft Visual Basic 6.0

uuuGef

40

yHk(57)

txufyg yH(k 57)tm; Run í &Edkifap&ef atmufygy½dk*&rfrsm;udka&;om;&rnf/ Check1 wGiaf tmufyg Program udka&;om;&efPrivate Sub Check1_Click() Dim a1 As Font Set a1 = Text1.Font If Check1.Value = 1 Then a1.Bold = True Else a1.Bold = False End If End Sub Check2 wGiaf tmufyg Program udka&;om;&efPrivate Sub Check2_Click() Dim a1 As Font Set a1 = Text1.Font If Check2.Value = 1 Then a1.Italic = True


Contents Microsoft Visual Basic 6.0

41

Else a1.Italic = False End If End Sub Check3 wGiaf tmufyg Program udka&;om;&efPrivate Sub Check3_Click() Dim a1 As Font Set a1 = Text1.Font If Check3.Value = 1 Then a1.Underline = True Else a1.Underline = False End If End Sub Check4 wGiaf tmufyg Program udka&;om;&efPrivate Sub Check4_Click() Dim a1 As Font Set a1 = Text1.Font If Check4.Value = 1 Then a1.Strikethrough = True Else a1.Strikethrough = False End If End Sub Close Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command1_Click() Unload Me End Sub

uuuGef


Contents Microsoft Visual Basic 6.0

42

uuuGef

Number System (Pulldown Menu) twGuf Program a&;om;jcif; Pulldown Menu wpfcjk zpfaom Number udak ½G;ygu 4if;ESiv hf u kd af vsmnDaxGjzpf ap&ef aemufxyf Form wpfczk efw;D í vdt k yfaomy½d*k &rfrsm;a&;om;&rnf/ yH(k 58)/

yHk(58)

tqdyk g Form yHpk w H iG f tpDtpOfrsm;udk Run Edik &f eftwGuf atmufygtwdik ;f jyifqif &rnf/ yHk(59)/

yHk(59)

, , ESifh wdu Yk kd txufyg oH;k xm;ygonf/ 4if; Form yHpk w H iG f Run í&Edik af p&ef vdt k yfaomy½d*k &rfrsm;udk a&;om; &rnf/


Contents Microsoft Visual Basic 6.0

43

uuuGef

General, Declarations wGiaf tmufyg Program udak &;om;&efDim a As Integer Close Command Button wGiaf tmufyg Program udka&;om;&efPrivate Sub Command1_Click() Unload Me End Sub Option1 wGiaf tmufyg Program udka&;om;&efPrivate Sub Option1_Click() Label2.Caption = Format(a) End Sub Option2 wGiaf tmufyg Program udka&;om;&efPrivate Sub Option2_Click() Label3.Caption = Oct(a) End Sub Option3 wGiaf tmufyg Program udka&;om;&efPrivate Sub Option3_Click() Label4.Caption = Hex(a) End Sub Text1 wGiaf tmufyg Program udka&;om;&efPrivate Sub Text1_Change() a = Val(Text1.Text) End Sub Options Menu wGif xyfrĂ­ H Multiple Column List Box, Scroll Bars, Control Array wdkYudkzefwD;&ef/ yHk(60)/

yHk(60)


Contents Microsoft Visual Basic 6.0

44

uuuGef

Multiple Column List Box (Pulldown Menu) twGuf Program a&;om;jcif; Pulldown Menu wpfcjk zpfaom Multiple Column List Box udka½G;ygu 4if;ESifh vdu k af vsmnDaxGjzpfap&ef aemufxyf Form wpfczk efw;D í vdt k yfaomy½d*k &rfrsm;a&;om;

&rnf/ yHk(61)/

yHk(61)

tqdyk g Form yHkpHwGif tpDtpOfrsm;udk Run Edik &f eftwGuf atmufygwdik ;f jyifqif &rnf/yHk(62)/

yHk(62)

tqdyk gyH(k 62)udk zefw;D &mwGif ESifh wdu Yk o kd ;kH xm; ygonf/ List1 List Box \ Properties wGif atmufygwdu Yk jkd yifqifxm;½S&d rnf Columns MultiSelect

-

2 2 - Extended


Contents Microsoft Visual Basic 6.0

45

uuuGef

yHk(62)yg Form yHkpHtm; Run í&Edkifap&ef atmufygy½dk*&rfrsm;udka&;om;&rnf/ Transfer Command Button twGuf Private Sub Command1_Click() For n = 0 To (List1.ListCount - 1) If List1.Selected(n) = True Then ' If selected then add to the bottom list. List2.AddItem List1.List(n) End If Next Command2.Enabled = True 'An item is now in the bottom list, so enable the clear button. End Sub Clear Command Button twGuf Private Sub Command2_Click() List2.Clear Command2.Enabled = False End Sub Close Command Button twGuf Private Sub Command3_Click() Unload Me End Sub 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 "Mingaladom" List1.AddItem "South Okkalapa" List1.AddItem "North Dagon"


Contents Microsoft Visual Basic 6.0

46

uuuGef

List1.AddItem "South Dagon" List1.Selected(1) = True End Sub List1 List Box Double Click twGuf Private Sub List1_DblClick() Command1.Value = True 'A user clicked the Transfer button. End Sub Scroll Bars (Pulldown Menu) twGuf Program a&;om;jcif; Pulldown Menu wpfcjk zpfaom Scroll Bars udak ½G;ygu 4if;ESiv hf u kd af vsmnDaxG jzpfap&ef Form wpfckzefwD;í vdktyfaomy½dk*&rfrsm;a&;om;&rnf/ yHk(63)/

yHk(63)

tqdyk g Form yHkpHwGif tpDtpOfrsm;udk Run Edkif&eftwGuf yHk(64)ygtwdkif;jyifqif &rnf/ , , ESifh wdu Yk o kd ;kH xm; ygonf/

yHk(64)


Contents Microsoft Visual Basic 6.0

47

uuuGef

Function wpfckjzpfaom DoColor twGuf

yHk(65)wGifazmfjyxm;ygonf/

yHk(65)

Close Command Button twGuf Private Sub Command1_Click() Unload Me End Sub Red Horizontal Scroll Bar twGuf Private Sub HScroll1_Change() HScroll1_Scroll 'Call the event procedure directly. End Sub Private Sub HScroll1_Scroll() DoColor End Sub Green Horizontal Scroll Bar twGuf Private Sub HScroll2_Change() HScroll2_Scroll 'Call the event procedure directly. End Sub Private Sub HScroll2_Scroll() DoColor End Sub


Contents Microsoft Visual Basic 6.0

48

uuuGef

Blue Horizontal Scroll Bar twGuf Private Sub HScroll3_Change() HScroll3_Scroll 'Call the event procedure directly. End Sub Private Sub HScroll3_Scroll() DoColor End Sub Menu Bar aemufwpfckxyfrHjyKvkyfjcif; yHk(66)ygyHkwGif Menu wpfco k m½SNd y;D Menu rSxu G cf gG vdyk gu Command Button wpfcu k t kd oH;k jyKí xdk Command Button udk Click jyKvkyfjcif;jzifh xGufcGgEdkifayonf/ þuJo h Ykd Menu rSxu G cf gG vdo k nfh aemufxyf Menu Bar wpfcw k nfaqmufvykd gu Tools udak ½G;yg/ xdaYk emuf Pulldown Menu wpfcjk zpfaom Menu Editor ... udka½G;yg/

yHk(66)

xdt k cg yH(k 67)ygtwdik ;f Menu Editor ay:vmrnf/ 4if; ...&Scroll Bars wGif Active jzpfatmifxm;í Next Command Button udak ½G;yg/ xdaYk emuf Caption wGif E&xit, Name wGif Exit [kjznfp h u G í f Left Arrow Button tm;a½G;ygu ...E&xit onf E&xit jzpfomG ;ayrnf/ a½SUqH;k rSO;D aqmifonfh ... aysmufomG ;ayrnf/ xdaYk emuf Exit \atmufwiG ½f adS om Pulldown Menu rsm;tm; qufvufzefw;D &efjzpfonf/ yH(k 67)? yHk(68)/


Contents Microsoft Visual Basic 6.0

49

uuuGef

yHk(67)

yHk(68)


Contents Microsoft Visual Basic 6.0

uuuGef

50

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

yHk(69)

txufygyH(k 69)yg Pulldown Menu wpfcjk zpfaom Quit tm; Double Click ESdyf íatmufygy½d*k &rftm;a&;om;&rnf Pulldown Menu wpfckjzpfaom Quit twGuf Private Sub Quit_Click() Unload Me End End Sub ---------------0-0-0---------------

txufyg y½d*k &rfrsm;udak &;&eftwGuf atmufyga&;xH;k rsm;udk od½&dS efvt kd yfygonf/ Syntax; Val(<String>) String wpfct k m; wGuí f csuí f &aom wefz;kd wpfct k jzpf ajymif;vJay;onf/

Oyrm MyValue = Val("2457") MyValue = Val(" 2 45 7") MyValue = Val("24 and 57") Syntax; If <Condition> Then <Statements> [Else <Statements>] End If

' Returns 2457 ' Returns 2457 ' Returns 24


Contents Microsoft Visual Basic 6.0

51

uuuGef

(Or) If <Condition> Then [<Statements>] ElseIf <Conditon-n> Then [<Statements>]] ... [Else <Statements>]] End If

Oyrm Number = 53 'Initialize Variable If Number < 10 Then Digits = 1 ElseIf Number < 100 Then 'Condition evaluates to True so the next statement is executed. Digits = 2 Else Digits = 3 End If Syntax; <Object>.AddItem item, index <Object>.Clear <Object>.RemoveItem index

Oyrm Private Sub Form_Click() Dim Entry, I, Msg 'Declare variables. Msg = "Choose OK to add 100 items to your list box." MsgBox Msg 'Display message. For I = 1 To 100 'Count from 1 to 100. Entry = "Entry " & I 'Create entry. List1.AddItem Entry 'Add the entry. Next I Msg = "Choose OK to remove every other entry." MsgBox Msg 'Display message.


Contents Microsoft Visual Basic 6.0

52

uuuGef

For I = 1 To 50 'Determine how to List1.RemoveItem I 'Remove every other Next I 'Item. Msg = "Choose OK to remove all items from the list box." MsgBox Msg 'Display message. List1.Clear 'Clear list box. End Sub Syntax; <Object>.Bold [=boolean] <Object>.Italic [=boolean] <Object>.Underline [=boolean] <Object>.Strikethrough [=boolean]

Oyrm Private Sub Form_Click() Font.Bold = Not Font.Bold 'Toggle bold. Font.StrikeThrough = Not Font.StrikeThrough 'Toggle Strikethrough Font.Italic = Not Font.Italic 'Toggle italic Font.Underline = Not Font.Underline 'Toggle underline Font.Size = 16 'Set size property If Font.Bold then Print "Font weight is " & Font.Weight & " (bold)." Else Print "Font weight is " & Font.Weight & " (not bold)." End If End If Syntax; Oct(<Number>)

Oyrm MyOct = Oct(4) MyOct = Oct(8) MyOct = Oct(459) Syntax; Hex(<Number>)

'Returns 4 'Returns 10 'Returns 713

Oyrm MyHex = Hex(5)

'Returns 5


Contents Microsoft Visual Basic 6.0

53

uuuGef

MyHex = Oct(8) 'Returns A MyHex = Oct(459) 'Returns 1CB Syntax; Format(expression[,format[,firstdayofweek [,firstweekofyear]]])

Oyrm MyTime = #17:04:23# MyDate = #January 27, 1993# 'Returns current system time in the system-defined long time format. MyStr = Format(Time, "Long Time") MyStr = Format(MyTime, "h:m:s") 'Returns "17:4:23" MyStr = Format(MyTime, "hh:mm:ss AMPM") 'Returns "05:04:23 PM" MyStr = Format(MyDate, "dddd, mmm d yyyy") 'Returns "Wednesday, Jan 27 1993" 'If format is not supplied, a string is returned. MyStr = Format(23) 'Returns "23". 'User-defined formats. MyStr = Format(5459.4, "##,##0.00") 'Returns "4,459.40". MyStr = Format(334.9,"###0.00") 'Returns "334.90". MyStr = Format(5, "0.00%") 'Returns "500.00%". MyStr = Format("HELLO", "<") 'Returns "hello". MyStr = Format("This is it", ">") 'Returns "THIS IS IT". Syntax; <Object>.BackColor [=color] <Object>.ForeColor [=color]

Oyrm Private Sub Form_Load() Timer1.Interval = 500 End Sub Private Sub Timer1_Timer() BackColor = QBColor(Rnd * 15) ForeColor = QBColor(Rnd * 10) Picture1.BackColor = QBColor(Rnd * 15) Picture1.ForeColor = QBColor(Rnd * 10) End Sub


Contents Microsoft Visual Basic 6.0

uuuGef

54

Syntax; RGB(red, green, blue) Red, Green, Blue wefz;kd rsm;onf 0 ESihf 0255 Mum;½SMd uonf/

Oyrm Red = RGB(255, 0, 0) 'Return the value for Red. I = 75 'Initialize offset. RGBValue = RGB(I, 64 + I, 128 + I) 'Same as RGB(75, 139, 203). MyObject.Color = RGB(255, 0, 0) 'Set the Color property of MyObject to Red. Color Red Value Green Value Blue Value Black 0 0 0 Blue 0 0 255 Green 0 255 0 Cyan 0 255 255 Red 255 0 0 Magenta 255 0 255 Yellow 255 255 0 White 255 255 255 Syntax; <Object>.ListCount <Object>.ListIndex [=index] <Object>Selected(index) [=boolean]

Oyrm(1) Dim Player(0 To 2) Dim Salary(0 To 2) Private Sub Form_Load() Dim I AutoSize = True Player(0) = "Miggey McMoo" Player(1) = "Alf Hinshaw" Player(2) = "Woofer Dean" Salary(0) = "$234,500" Salary(1) = "$158,900"

'Declare Variable. 'Enter data into arrays.


Contents Microsoft Visual Basic 6.0 Salary(2) = "$1,030,500" For I = 0 To 2 Combo1.AddItem Player(I) Next I Combo1.ListIndex = 0 End Sub

uuuGef

55

'Add names to list.

'Display first item in list.

Private Sub Combo1_Click() 'Display corresponding salary for name. Label1.Caption = Salary(Combo1.ListIndex) End Sub

Oyrm(2) Private Sub Form_Load() Dim I 'Declare Variable. 'Fill the list box with screen font names. For I = 0 To Screen.FontCount - 1 List1.AddItem Screen.Fonts(I) Next I End Sub Private Sub Command1_Click() Dim I 'Declare Variable. 'Clear all items from the list. List2.Clear 'If an item is selected, add it to List2. For I = 0 To List1.ListCount - 1 If List1.Selected(I) Then List2.AddItem List1.List(I) End If Next I End Sub


Contents Microsoft Visual Basic 6.0

56

Syntax; Load <Object> Unload <Object>

Oyrm Private Sub Form_Click() Dim Answer.Msg 'Declare Variable Unload Form1 Msg = "Form1 has been unloaded. Choose Yes to load and " Msg = Msg & "display the form. Choose No to load the form " Msg = Msg & "and leave it invisible." Answer = MsgBox(Msg, 4) 'Get user response. If Answer = 6 Then 'Evaluate answer. Show 'If Yes, show form. Else Load Form1 'If No, just load it. Msg = "Form1is now loaded. Choose OK to display it." MsgBox Msg 'Display message. Show 'Show form. End If End Sub Syntax; <Object>.Hide <Object>.Show

Oyrm Private Sub Form_Click() Dim Answer.Msg 'Declare Variable Hide Msg = "Choose OK to make the form reappear." MsgBox Msg 'Display message. Show 'Show form again. End Sub

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

57

Syntax; <Object>.Enabled [=boolean] <Object>.Visible [=boolean] <Object>.SetFocus

Oyrm Private Sub Form_Click() Text1.Text = "" Command1.Caption = "Save" End Sub Private Sub Text1_Change() If Text1.Text = "" Then Command1.Enabled = False Else Command1.Enabled = True End If End Sub

'Clear the text box. 'Put caption on button.

'See if text box is empty. 'Disable button. 'Enable button.

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


Contents

uuuGef

58

Microsoft Visual Basic 6.0

tcef;(3) rsm;udk Windows yHkpHtwdkif;½SmazGjcif; Graphic rsm;ud atmufyg yH(k 70)ygtwdik ;f Visual Basic 6.0 wGizf efw;D &ef/

(1) (4) (2)

yHk(70) (6)

(3) (5)

yHk(70)yg Form wGif(1)udk File List Box Drive List Box

jzifhzefwD;xm;NyD;(2) tm;

jzifzh efw;D xm;ygonf/(3)udk Label

jzifhzef

jzifzh efw;D xm;onf/(5)udk Command wD;xm;Ny;D (4)tm; Dir List Box jzifzh efw;D xm;í(6)udk Image jzifzh efw;D xm;ygonf/ Button File1 File List Box \ Properties wGiaf tmufygtwdi k ;f jyifqif&efPattern = *.bmp;*.wmf;*.pic;*.jpg;*.ico;*.gif k ;f jyifqif&efLabel1 Label \ Properties wGif atmufygtwdi Border Style = Fixed Single k ;f jyifqif&efImage1 Image \ Properties wGif atmufygtwdi Border Style = Fixed Single Stretch = True Command1 Command Button \ Properties wGif atmufygtwdi k ;f jyifqif&efCaption = E&xit


Contents Microsoft Visual Basic 6.0

59

uuuGef

wpfzufygtwdik ;f Properties rsm;udk jyifqifjznfph u G Nf y;D ygu oufqikd &f mtydik ;f vdu k f atmufygtwdik ;f y½d*k &rfrsm;a&;om;&efjzpfygonf/ Command Button jzpfaom Exit twGuf Private Sub Command1_Click() Unload Me End End Sub Directory List Box twGuf Private Sub Dir1_Change() File1.Path = Dir1.Path 'Update Files End Sub Drive List Box twGuf Private Sub Drive1_Change() Dir1.Path = Drive1.Drive 'Update Directory Path End Sub File List Box twGuf (Single Click) Private Sub File1_Click() Label1 = File1 End Sub 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 Form twGuf Private Sub Form_Load() Drive1.Drive = App.Path Dir1.Path = App.Path End Sub ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

uuuGef

60

wpfzufygy½d*k &rfrsm;udak &;&eftwGuf atmufyga&;xH;k rsm;udk od½&dS efvt kd yfygonfSyntax; <Object>.Drive [=drive]

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

'When drive changes, set directory path.

Private Sub Dir1_Change() File1.Path = Dir1.Path 'When directory changes, set file path. End Sub Syntax; <Object>.FileName [=pathname]

Oyrm Private Sub Dir1_Change() File1.Path = Dir1.Path 'Set File1 path. End Sub Private Sub File1_PathChange() Dir1.Path = File1.Path 'Set Dir1 path. End Sub Private Sub File1_DblClick() 'Display the selected filename when double-clicked. Label1.Caption = "Your selection: " + UCase(File1.FileName) End Sub Syntax; <Object>.Path [=pathname]

Oyrm Private Sub Drive1_Change() Dir1.Path = Drive1.Drive End Sub Private Sub Dir1_Change() File1.Path = Dir1.Path End Sub

'Set directory path.


Contents Microsoft Visual Basic 6.0

61

Syntax; LoadPicture([stringexpression])

Oyrm Private Sub Form_Click() Dim Msg 'Declare Variables. On Error Resume Next 'Set up error handling. Height = 3990: Width = 4890 'Set Height and Width. Picture = LoadPicture("PAPER.BMP") If Err Then Msg = "Couldn't find the .BMP file." MsgBox Msg 'Display error message. Exit Sub End If Msg = "Choose OK to clear the bitmap from the form." MsgBox Msg Picture = LoadPicture() 'Clear form. End Sub Syntax; <Object>.Picture [=picture]

Oyrm Private Sub Form_Load() 'Load the icons. Picture1.Picture = LoadPicture("icons\computer\trash02a.ico") Picture2.Picture = LoadPicture("icons\computer\trash02b.ico") End Sub ---------------0-0-0---------------

uuuGef


Contents

uuuGef

62

Microsoft Visual Basic 6.0 Timer jzifhtcsdefudkzefwD;jcif;

atmufazmfjyygyH(k 71)ygtwdik ;f Visual Basic 6.0 wGizf efw;D &rnf(1)

yHk(71) (2)

yHk(71)yg Form wGif (1)udk jzifzh efw;D xm;Ny;D (2)tm; jzifh zefw;D xm;ygonf/ txufygtwdik ;f jyifqifNy;D ygu oufqikd &f mtydik ;f vdu k f y½d*k &rfrsm;a&;om; &efjzpfygonf/ Form qJGwif&mwGiftvkyfvkyf&eftwGuf Private Sub Form_Load() Timer1.Interval = 1000 End Sub Label1 wGiftcsdefjy&eftwGuf Private Sub Timer1_Timer() Label1.Caption = Time End Sub Syntax; <Object>.Interval [=milliseconds]

'Set Time Interval

'Update Time Display

Oyrm Private Sub Form_Load() Timer1.Interval = 900 HScroll1.Min = 100 HScroll1.Max = 900 End Sub

'Set interval. 'Set minimum. 'Set maximum.


Contents

uuuGef

63

Microsoft Visual Basic 6.0

Private Sub HScroll_Change() 'Set interval according to scroll bar value. Timer1.Interval = 1000 - HScroll.Value End Sub Private Sub Timer1_Timer() 'Switch BackColor between red and blue. If Picture1.BackColor = RGB(255, 0, 0) Then Picture1.BackColor = RGB(0, 0, 255) Else Picture1.BackColor = RGB(255, 0, 0) End If End Sub Time Function Syntax; Time

Oyrm Mytime = Time Date Function Syntax; Date

'Return Current System Time

Oyrm MyDate = #February 12, 1985# 'Assign a date Date = MyDate 'Change System Date. Syntax; Now ' Returns the current date and time according.

Oyrm Today = Now Day Function Syntax; Day(date)

'Assign current system date and time

Oyrm MyDate = #February 12, 1969# MyDay = Day(MyDate)

'Assign a date 'MyDay contains 速 12


Contents Microsoft Visual Basic 6.0

uuuGef

64

Hour Function Syntax; Hour(time)

Oyrm Mytime = #4:35:17 PM# MyHour = Hour(Mytime) Minute Function Syntax; Minute(time)

'Assign a time 'MyHour contains 16

Oyrm Mtime = #4:35:17 PM# MyMinute = Minute(Mytime) Month Function Syntax; Month(date)

'Assign a time 'MyMinute contains 85

Oyrm Mydate = #February 12, 1969# MyMonth = Month(Mydate) Second Function Syntax; Second(time)

'Assign a date 'MyMonth contains 2

Oyrm Mytime = Time MySecond = Second(Mytime) Weekday Function Syntax; Weekday(date,[firstday of week])

'Returns current system time 'MySecond contains 17

Oyrm MyDate = #February 12, 1969# MyWeekDay = Weekday(MyDate) Year Function Syntax; Year(date)

'Assign a date. 'MyWeekDay contains 4 because 'MyDate represents a Wednesday.


Contents Microsoft Visual Basic 6.0

uuuGef

65

Oyrm MyDate = #February 12, 1969# MyYear = Year(MyDate)

'Assign a date. 'MyYear contains 1969.

tcsdefESifhywfoufaom Function rsm;udk Form zefwD;Ă­prf;oyfjcif; atmufygyH(k 72)ygtwdik ;f Visual Basic 6.0 wGizf efw;D &ef/

yHk(72)

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


Contents Microsoft Visual Basic 6.0 Print "My Hour Print "My Minute Print "My Second Print "My Month Print "My Week Day Print "My Year Print "Now End Sub

uuuGef

66 ", MyHour ", MyMinute ", MySecond ", MyMonth ", MyWeekDay ", MyYear ", Today

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

yHk(73)

Random Function Initializes the random-number generator. Syntax; Randomize [number] The number argument can be any valid numeric expression.

Oyrm Randomize 'Initialize random-number generator. MyValue = Int(6 * Rnd) + 1) 'Generate random value between 1 and 6 Syntax; Rnd [(number)] Returns a random number. The number argument can be any valid numeric expression. Move Method Syntax; <Object>.Move left, top, width, height


Contents Microsoft Visual Basic 6.0

uuuGef

67

<Object>.Left [=value] <Object>.Top [=value] atmufyg yH(k 74)wGit f m; Move Sample Title Bar jzifhzefwD;xm;&ef -

yHk(74)

txufygyH(k 74)wGif Image, Timer, Command Button wdy Yk g0ifMu onf/ Timer Properties wGif Interval tm; 100 [kxm;yg/ Command Button wGif vdt k yfaomy½d*k &rfrsm;udak &;om;&rnf/ Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub Timer1_Timer twGuf Private Sub Timer1_Timer() a = Image1.Left b = Image1.Top Image1.Move a + 50, b + 33 End Sub

atmufyg yH(k 75)tm; Move Method Example Title Bar jzifh zefwD;xm;&ef-


Contents Microsoft Visual Basic 6.0

68

uuuGef

yHk(75)

txufygyH(k 75)wGif Image, Command Button wdyYk g0ifMuonf/ Form1 Form Properties wGif Windows State tm; 2 - Maximized [kxm;yg/ Command k yfaomy½d*k &rfrsm;udak &;om;&rnf/ Button wGif vdt Run Command Button twGuf Private Sub Command1_Click() For j = 1 To 10 Image1.Left = 0 Image1.Top = 0 i = Image1.Left k = Image1.Top For i = 0 To 11500 Image1.Move i, k Next Image1.Left = 11500 Image1.Top = 0 i = Image1.Left k = Image1.Top For k = 0 To 7700 Image1.Move i, k Next


Contents Microsoft Visual Basic 6.0

69

Image1.Left = 11500 Image1.Top = 7700 i = Image1.Left k = Image1.Top For i = 11500 To 0 Step -1 Image1.Move i, k Next Image1.Left = 0 Image1.Top = 7700 i = Image1.Left k = Image1.Top For k = 7700 To 0 Step -1 Image1.Move i, k Next Print Print Print " ", j Beep Next End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------

uuuGef


Contents Microsoft Visual Basic 6.0

70

uuuGef

tcef;(4) ODBC ü Access File tm;toHk;jyKEdkifap&ef aqmif½Gufjcif; yxrtqift h aejzifh Access 2002 jzifh Database File ESifh Table File tm;wnf aqmufyg/ xdaYk emuf Windows Desktop Status Bar wGi½f adS om Start Menu tm; a½G;yg/ xdkYaemuf Setting udx k yfraH ½G;yg/ xdt k cg aemufxyf Sub-Menu wpfcak y:vm rnf/ 4if;rS Control Panel udka½G;yg/ yHk(76)/

yHk(76)

xdt k cg Control Panel Dialog Box ay:vmrnf/ yHk(77)/


Contents Microsoft Visual Basic 6.0

71

uuuGef

yHk(77) Control Panel Dialog Box ½Sd Icon rsm;xJrS ODBC Data Sources [32bit] udk Double Click ESdyfyg/ yHk(78)ygtwdkif; ODBC Data Source Administrator Dialog Box ay:vmrnf/


Contents Microsoft Visual Basic 6.0

72

uuuGef

yHk(78)

txufyg Dialog Box wGif User DSN, System DSN, File DSN, Drivers, Tracing, Conection Pooling, About [lí Tab Command 7 ckyg½Sdygonf/ 4if; Tab Command rsm;xJrS System DSN udka½G;yg/ yHk(79)ygtwdkif;jzpfay:vmrnf/


Contents Microsoft Visual Basic 6.0

73

uuuGef

yHk(79)

txufygyHw k iG f Add Command Button udak ½G;&rnf/ xdt k cg Create New Data Source Dialog Box ay:vmrnf/ yH(k 80)/

yHk(80)

txufyg Dialog Box wGif Driver do Microsoft Access [*.mdb] udka½G;NyD; Finish udak ½G;cs,& f rnf/ ODBC Microsoft Access Setup Dialog Box ay:vmygu Data Source Name acgif;pOfnmzuf½Sd List Box wGif rdrBd uKu d Ef pS o f uf&mtrnfwpfck udjk znfph u G yf g/ Oyrm Test1 [kjznfph u G yf g/ yH(k 81)/


Contents Microsoft Visual Basic 6.0

74

uuuGef

yHk(81)

xdaYk emuf Database acgif;pOfatmuf½dS Select... Command Button udak ½G;cs,f &rnf/ xdt k cg rdrt d vd½k o dS nfh Access 2002 Database File tm;a½G;cs,fEdkifap&ef Select Database Dialog Box ay:vmayrnf/ yHk(82)/

yHk(82)

txufygyH(k 82)rS rdrpd w d Bf uKu d f Database File tm; yH(k 83)ygtwdik ;f a½G;cs,&f rnf/


Contents Microsoft Visual Basic 6.0

75

uuuGef

yHk(83)

xdaYk emuf OK Command Button udak ½G;cs,&f rnf/ xdt k cg ODBC Microsoft dS mG ;rnf/ yH(k 84)/ Access Setup Dialog Box odjYk yefvnfa&muf½o

yHk(84)

txufyg Dialog Box wGif Database: acgif;pOfnmzufwiG f rdrad ½G;cs,cf ahJ om vrf;aMumif;ESihf zdik t f m;jyvdrrhf nf/ Oyrm - c:\My Documents\Test1.mdb/ xdaYk emuf Command Button wpfcjk zpfaom OK udak ½G;cs,& f rnf/


Contents Microsoft Visual Basic 6.0

76

uuuGef

yHk(85)

xdktcg yHk(85)yg ODBC Data Source Administrator Dialog Box odjYk yefvnf a&muf½o dS mG ;Ny;D System Data Sources: acgif;pOfatmufwiG f Name ® Test1, Driver ® Microsoft Access Driver(*.mdb) azmfjyaeayrnf/ xdaYk emuf Command Butf rnf/ xdt k cg rlvae&mjzpfaom Control Panel ton wpfcjk zpfaom OK udak ½G;cs,& ae&modjYk yefvnfa&muf½o dS mG ;Ny;D Access 2002 Database File tm; Visual Basic k rf nf/ yH(k 86)/ Microsoft Access 2002 jzifw h nfaqmufxm; 6.0 wGif toH;k jyKí&Edi aom C:\My Documents\Test1.mdb onf ODBC Data Sources (32bit) jzpfomG ; ayrnf/


Contents Microsoft Visual Basic 6.0

77

uuuGef

yHk(86)

---------------0-0-0--------------Visual Basic 6.0 wGif ODBC Data Sources qJGwifjcif; Visual Basic 6.0 udkzGifhyg/ Project1-Form1 (Form) ½Sd Form1 wGif atmufyg

yH(k 87)ygtwdik ;f wnfaqmufxm;&rnf/

yHk(87)

xdaYk emuftcsut f vufzikd zf iG &hf ef Command1, y½dk*&rfrSxGuf&ef Command2 wdYk twGuyf (kH 88)ygtwdik ;f Program rsm;a&;om;&rnf/


Contents Microsoft Visual Basic 6.0

uuuGef

78

yHk(88)

Data Form Wizard wnfaqmufjcif; Menu Bar ½Sd Add-Ins rS Data Form Wizard udka½G;yg/ yHk(89)/

yHk(89)

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

yHk(90)


Contents Microsoft Visual Basic 6.0

79

uuuGef

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/

yHk(91)

xdt k cg txufygyH(k 91)ygtwdik ;f Data Form Wizard - Database Type Dialog G f Access udak ½G;xm;vdrrhf nf/ rdrrd S Remote Box ay:vmNyD; 4if;xJ½Sd List Box xJwi f rnf/ (ODBC) tm;a½G;Ny;D Next udak ½G;cs,&

yHk(92)

xdt k cg yH(k 92)ygtwdik ;f Data Form Wizard - Connect Information Dialog Box ay:vmNyD; ODBC Connect Data acgif;pOfatmuf½Sd DSN: nmzuf½dS List Box udak ½G;cs,yf gu yH(k 93)ygtwdik ;f Dropdown List Box ay:vmygu Test1 udak ½G;cs,Nf y;D Next udka½G;cs,f&rnf/ yHk(94)/


Contents Microsoft Visual Basic 6.0

80

uuuGef

yHk(93)

yHk(94)

xdt k cg Data Form Wizard - Form Dialog Box ay:vmrnf/ What name d Ef pS o f uf&mtrnfukd do you want for the form? acgif;pOfatmuf List Box wGif rdrBd uKu jznfhpGuf&ef/ Oyrm - Form2 [kjznfph u G í f Next udak ½G;&rnf/ yH(k 95)/


Contents Microsoft Visual Basic 6.0

81

uuuGef

yHk(95)

yHk(95)wGif Next udak ½G;cs,yf gu Dara Form Wizard - Record Source Dialog Box ay:vmrnf/

yHk(96)

txufygyHw k iG f Record Source: List Box Dropdown Arrow tm;a½G;cs,Nf y;D Test1 udx k m;&ef/ xdt k cg Available Fields: acgif;pOfatmufwiG f Test1 Database dS mvdrrhf nf/ 4if;rS rdrEd pS o f ufonfh File wGif wnfaqmufxm;aom Field rsm;a&muf½v Field rsm;udka½G;cs,f&rnf/ yHk(97)/


Contents Microsoft Visual Basic 6.0

82

uuuGef

yHk(97)

txufygyH(k 97)wGif rdrt d vd½k o dS nfh Field rsm;udw k pfcck si;f tvdu k f Right h nf;aumif;? Field tm;vH;k udk Right Arrow ESpf Arrow Command Button jzifv ckyg Command Button jzifv h nf;aumif;a½G;cs,Ef ikd yf gonf/ Column to Sort By: acgif;pOfatmuf List Box wGif rdrt d aejzifh i,fpOfBu;D vdu k pf pD Ofvakd om Field rsm;udk a½G;cs,v f u kd a½G;cs,Ef ikd yf gonf/ xdaYk emuf Next udka½G;cs,fyg/ yHk(98)/

yHk(98)


Contents Microsoft Visual Basic 6.0

83

uuuGef

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)/

yHk(99)

txufygyH(k 99)udk ajymif;vJrrI jyKvyk b f J Next udx k yfraH ½G;cs,yf g/ xdt k cg Data Form Wizard - Finished! Dialog Box ay:vmayrnf/ yHk(100)/

yHk(100)

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


Contents Microsoft Visual Basic 6.0

84

uuuGef

yHk(101) yHk(101)wGif OK udak ½G;cs,&f rnf/ xdt k cg yH(k 102)ygtwdik ;f jzpfay:vmrnf/

yHk(102)

Visual Basic 6.0 rS tvdt k avsmufwnfaqmufay;vdu k af om Form2 jzpfay:vm

ayrnf/ ---------------0-0-0---------------


Contents Microsoft Access 2002

85

uuuGef

rdrdenf;jzifh Access File toHk;jyKaomy½dk*&rfa&;om;jcif; rdrdenf;? rdrd[efjzifh Access 2002 wGif Database File wnfaqmufxm;Ny;D Vik oH;k jyKí Programming a&;om;Edik yf gonf/ atmufazmfjyygyH(k 103) sual Basic 6.0 udt tm; Toolbox ½Sd Icon rsm;udt k oH;k jyKíwnfaqmufxm;&rnf/

yHk(103)

yHk(103)yg Form wGif Command Button udt k oH;k jyKí zdik zf iG &hf ef? xGu&f efwu Ykd kd zefw;D wnfaqmufxm;ygonf/ tqdyk g Form onf Form1 jzpfNyD; xGuf&ef Command Button udkESdyfygu 4if;y½dk*&rfxJrSxGufoGm;NyD;? zdkifzGifh&ef Command Button udka½G;ygu Form2 jzifhpDpOfxm;aom Microsoft Access 2002 Database File ay:vmayrnf/ xdaYk Mumifh Form2 udak tmufygtwdik ;f wnfaqmuf&ayrnf/ yH(k 104)/

yHk(104)


Contents Microsoft Access 2002

86

uuuGef

yH(k 104)yg Identification Number;, Rank;, Name;, Department; [kteufa&mif jzifah &;om;xm;aompmrsm;onf Label1, Label2, Label3, Label4 wdjYk zifw h nfaqmuf xm;jcif;jzpfNy;D 4if;pmom;rsm;\nmzufwiG f wnfaqmufxm;aom Box rsm;rSm Text h nfaqmufxm;ygonf/ Add, Update, Delete, Refresh, Close wdrYk mS Box rsm;jzifw Command Button rsm;jzpfMuygonf/ 4if; Command Button 5 ck\nmzufwi G f ½So d nfh Data Position Box rSm jzifw h nfaqmufxm;ygonf/ Command jzifw h nfaqmuf Button rsm;ESihf Adodc wdaYk tmufzufwiG ½f adS eaomZ,m;udk xm;Muygonf/ Label1 Label \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Label1 Alignment 0 - Left Justify AutoSize True Caption Identification Number; Label2 Label \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Label2 Alignment 0 - Left Justify AutoSize True Caption Rank; Label3 Label \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Label3 Alignment 0 - Left Justify AutoSize True Caption Name; Label4 Label \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Label4 Alignment 0 - Left Justify AutoSize True Caption Department; Text1 Text \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Text1 Alignment 0 - Left Justify DataField Identification Number DataSource Adodc1


Contents Microsoft Access 2002

87

uuuGef

Text2 Text \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Text2 Alignment 0 - Left Justify DataField Rank DataSource Adodc1 k ;f jyifqif&efText3 Text \ Properties wGiaf tmufygtwdi Name Text3 Alignment 0 - Left Justify DataField Name DataSource Adodc1 k ;f jyifqif&efText4 Text \ Properties wGiaf tmufygtwdi Name Text4 Alignment 0 - Left Justify DataField Department DataSource Adodc1 Command1 Command Button \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Command1 Caption &Add Command2 Command Button \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Command2 Caption &Update Command3 Command Button \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Command3 Caption &Delete Command4 Command Button \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Command4 Caption &Refresh Command5 Command Button \ Properties wGiaf tmufygtwdi k ;f jyifqif&efName Command5 Caption &Close


Contents Microsoft Access 2002

yHk(105)

uuuGef

88

yHk(106)

Adodc1 Adodc \ Properties udk yHk(105)? yHk(106)wdkYjzifhazmfjytyfygonf/ ConnectionString

-

RecordSource

-

Provider=MSDASQL.1;DSN=TEST1;UID=; PWD=; Select [Identification Number], Rank, Name, Department from Test1 Order By [Identification Number]


Contents Microsoft Access 2002

yHk(107)

uuuGef

89

yHk(108)

DataGrid1 DataGrid \ Properties udk yH(k 107)? yH(k 108)wdjYk zifah zmfjytyfygonf/ txufyg Form2 udk Run í&Edik af p&eftwGuf vdt k yfaomy½d*k &rfrsm;a&;om;&ayrnf/ Adodc1 Adodc wGif Record Position twGuf Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReason Enum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Adodc1.Caption = "Record: " & CStr(Adodc1.Recordset. AbsolutePosition) End Sub


Contents Microsoft Access 2002

90

Add Command Button twGuf Private Sub Command1_Click() Adodc1.Recordset.AddNew End Sub Update Command Button twGuf Private Sub Command2_Click() Adodc1.Recordset.Update End Sub Delete Command Button twGuf Private Sub Command3_Click() With Adodc1.Recordset .Delete .MoveNext If .EOF Then .MoveLast End With End Sub Refresh Command Button twGuf Private Sub Command4_Click() Adodc1.Refresh End Sub Close Command Button twGuf Private Sub Command5_Click() Form2.Hide Form1.Show End Sub Mouse Pointer Position twGuf Private Sub Form_Unload(Cancel As Integer) Screen.MousePointer = vbDefault End Sub

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

uuuGef


Contents Microsoft Access 2002

91

uuuGef

tcef;(5) String ESifhqdkifaomudpรถ&yfrsm; Syntax; Len(strin/varname)

Oyrm MyString = "Hello World" 'Initialize Variable. MyLen = Len(MyString) 'Returns 11. Syntax; Dim varname [([subscripts])][As [New] type[, varname [([subscripts])][As [New] type]]...

Oyrm 'Any Value and My Value are declared as Variant by default with values set to Empty. Dim AnyValue, MyValue 'Explicitly declare a variable of type integer. Dim Number As Integer 'Multiple declarations on a single line. Another Variable is of type Variant because its type is omitted. Dim AnotherVar, Choice As Boolean, BirthDate As Date 'DayArray is an array of Variants with 51 elements indexed, from 0 thru 50, assuming Option Base is set to 0 (default) for the current module Dim DayArray(50) 'Matrix is a two-dimensional array of integers. Dim Matrix(3, 4) As Integer 'MyMatrix is a three-dimensional array of doubles with explicit bounds. Dim MyMatrix(1 To 5, 4 To 9, 3 To 5) As Double


Contents Microsoft Access 2002

92

uuuGef

'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. Dim MyArray() Syntax; Str(<number>)

Oyrm MyString = Str(459) MyString = Str(-459.65) MyString = Str(459.001) Syntax; Left(string, length)

'Returns " 459". 'Returns "-459.65". 'Returns " 459.001".

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"


Contents Microsoft Access 2002

93

uuuGef

String Function rsm;udktoHk;jyKí udef;*Pef;rsm;wGufcsufjcif; atmufazmfjyyg Form yHpk t H m;zefw;D wnfaqmufyg/ yH(k 109)/

yHk(109) txufyg Form yHpk w H iG f Label, Text Box, Command Button wdjYk zifh zefw;D xm; NyD; Command Button rsm;wGif atmufygy½d*k &rfrsm;a&;om;&efjzpfygonf/ Run Command Button twGuf Private Sub Command1_Click() Cls Dim a(50) As Variant w = Text1.Text b=0 z = Len(Text1.Text) Print z: Print For i = 1 To z a(i) = Left(Right(Str(w), z - i + 1), 1) Print a(i) & "+"; Next For i = 1 To z b = b + Val(a(i)) Next Print "=", b c = Len(b) d=0


Contents Microsoft Access 2002

94

Print c: Print For j = 1 To c a(j) = Left(Right(Str(b), c - j + 1), 1) Print a(j) & "+"; Next For i = 1 To c d = d + Val(a(i)) Next Print "=", d e = Len(d) f=0 Print e: Print If e >= 2 And d >= 10 Then For j = i To c a(j) = Left(Right(Str(d), e - j + 1), 1) Print a(j) & "+"; Next For i = 1 To e f = f + Val(a(i)) Next Print "=", f End If End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub

uuuGef


Contents Microsoft Access 2002

95

uuuGef

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

yHk(110) Syntax; RSet strinvar = string

Oyrm MyString = "0123456789" RSet MyString = "Right ->"

'Initialize String. 'MyString contains " Right ->".

String toHk;jyKí Fibonacci Sequence udef;pOfwef;udk½Smjcif; atmufyg Form yHkpHtm; zefwD;wnfaqmufyg/ yHk(111)/ 4if;wGif Label, Text Box, Command Button wdjYk zifh zefw;D xm;Ny;D Command Button rsm;wGif atmufyg

y½dk*&rfrsm;a&;om;&efjzpfygonf/

yHk(111)


Contents Microsoft Access 2002

96

uuuGef

Run Command Button twGuf Private Sub Command1_Click() Dim n As Variant str1 = "1234567" Cls n = Text1: secondlast = 0: Last = 1 For k = 3 To n term = secondlast + Last: secondlast = Last: Last = term RSet str1 = Str(term) Print k, str1 Next End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu atmufygyHkpHtwdkif;jrifawGU&rnf/ yHk(112)/

yHk(112)


Contents Microsoft Access 2002

97

uuuGef

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

jzpfygonf/

yHk(113)

Run Command Button twGuf Private Sub Command1_Click() Dim a$(22, 21) Cls For i = 1 To 22 For j = 1 To 21 a$(i, j) = "*" Next j Next i For i = 1 To 20 For j = 1 To 21 - i a$(i, j) = "*" Next j Next i For i = 1 To 22 For j = 1 To 21 Print a$(i, j); Next j: Print Next i End Sub


Contents Microsoft Access 2002

98

uuuGef

Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu atmufygyHkpHtwdkif;jrifawGU&rnf/ yHk(114)/

yHk(114)

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

atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 115)/ 4if;wGif , , rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdt k yf aomy½d*k &rfrsm;a&;om;&ef jzpfygonf/

yHk(115)


Contents Microsoft Access 2002

99

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

uuuGef


Contents Microsoft Access 2002

100

uuuGef

End End Sub

tqdyk gy½d*k &rfukd Run ygu atmufygyH(k 116)twdik ;f azmfjyrnfjzpfonf/

yHk(116)

&m*Pef;½dkufxnfhygu 4if;udef;*Pef; 3 vHk;pvHk;aygif;jcif; H m; zefw;D wnfaqmufyg/ yH(k 117)/ 4if;wGif , atmufyg Form yHpk t , rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdt k yf aomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ yHk(117)

Run Command Button twGuf Private Sub Command1_Click() Cls n = Text1.Text A = n \ 100 n = n - (A * 100) b = n \ 10


Contents Microsoft Access 2002

101

uuuGef

n = n - (b * 10) Print "("; A; "+"; b; "+"; n; ")"; "="; A + b + n End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 118)twdik ;f azmfjyrnfjzpfonf/

yHk(118)

aemufwpfenf; atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 119)/ 4if;wGif , , rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdt k yf aomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ yHk(119)

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


Contents Microsoft Access 2002

uuuGef

102

Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 120)twdik ;f azmfjyrnfjzpfonf/

yHk(120)

Syntax; Mid(string, start, length)

Oyrm MyString = "Mid Function Demo" FirstWord = Mid(MyString, 1, 3) LastWord = Mid(MyString, 14, 4) MidWord = Mid(MyString, 5)

'Create text string. 'Returns "Mid". 'Returns "Demo". 'Returns "Function Demo".

aemufwpfenf; atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 121)/ 4if;wGif , , rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdt k yf aomy½d*k &rfrsm;a&;om;&ef jzpfygonf/

yHk(121) Run Command Button twGuf Private Sub Command1_Click() Cls n = Text1.Text s1 = Val(Mid(Trim(Str(n)), 1, 1))


Contents Microsoft Access 2002

103

uuuGef

Print s1 s2 = Val(Mid(Trim(Str(n)), 2, 1)) Print s2 s3 = Val(Mid(Trim(Str(n)), 3, 1)) Print s3 Print "3 Digits Sum of "; n; " is"; s1 + s2 + s3 End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 122)twdik ;f azmfjyrnfjzpfonf/

yHk(122)

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


Contents Microsoft Access 2002

104

uuuGef

tcef;(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; atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 123)/ 4if;wGif rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdktyfaomy½dk*&rfrsm;a&;om;&ef

jzpfygonf/

yHk(123)

Run Command Button twGuf Private Sub Command1_Click() 'To find No., AP, GP, Square Cls Print 1, 1, 1, 1 For j = 2 To 22 Print j, 2 * j - 1, 2 ^ (j - 1), j ^ 2 Next End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 124)twdik ;f azmfjyrnfjzpfonf/


Contents Microsoft Access 2002

105

uuuGef

yHk(124)

APudef;pOfwef;udk y½dk*&rfa&;om;jcif;

atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 125)/ 4if;wGif , , rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdt k yf aomy½d*k &rfrsm;a&;om;&ef jzpfygonf/

yHk(125)

Properties rsm;udjk yifqifjznfp h u G Nf y;D aemuf vdt k yfaomy½d*k &rfrsm;udak &;om;&rnf/


Contents Microsoft Access 2002

106

uuuGef

Run Command Button twGuf Private Sub Command1_Click() 'AP (Arithmetic Progression) Cls a = Val(Text1) d = Val(Text2) n = Val(Text3) Print " No? Terms Sum " k = 1: t = a: s = a Print k, t, s For k = 2 To n t = t + d: s = s + t: Print k, t, s Next End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 126)twdik ;f azmfjyrnfjzpfonf/

yHk(126)


Contents Microsoft Access 2002

107

uuuGef

GP udef;pOfwef;udk y½dk*&rfa&;om;jcif;

atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 127)/ 4if;wGif , , rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdt k yf aomy½d*k &rfrsm;a&;om;&ef jzpfygonf/

yHk(127)

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


Contents Microsoft Access 2002

108

uuuGef

tqdyk gy½d*k &rfukd Run ygu yH(k 128)twdik ;f azmfjyrnfjzpfonf/

yHk(128)

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

atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 129)/ 4if;wGif , , rsm;jzifzh efw;D xm;Ny;D Properties toD;oD;udk jyifqifjznfph u G f NyD;aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/

yHk(129)

Run Command Button twGuf Private Sub Command1_Click() 'To find the sum of N terms of the series 'S = 1 + 2 + 3 + ... + N Cls n = Val(Text1) If n = 0 Then End Sum = 1 For i = 2 To n Sum = Sum + i Next


Contents Microsoft Access 2002

109

uuuGef

Print "The sum of the series is "; Sum Print k, t, s End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 130)twdik ;f azmfjyrnfjzpfonf/

yHk(130)

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

atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 131)/ 4if;wGif , , rsm;jzifzh efw;D xm;Ny;D Properties toD;oD;udk jyifqifjznfph u G f NyD;aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/

yHk(131)

Run Command Button twGuf Private Sub Command1_Click() 'To find the Product of N terms of the series 'S = 1 * 2 * 3 * ... * N Cls n = Val(Text1) If n = 0 Or n > 17 Then End pro = 1


Contents Microsoft Access 2002

110

uuuGef

For i = 2 To n pro = pro * i Next Print "The Product of the series is "; pro End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 132)twdik ;f azmfjyrnfjzpfonf/

yHk(132)

udef;pOfwef; S = 1 + 1/4 + 1/9 + ... + 1/N*N wdkYudk½SmazGjcif; atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 133)/ 4if;wGif , , rsm;jzifzh efw;D xm;Ny;D Properties toD;oD;udk jyifqifjznfph u G f NyD;aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ yHk(133)

Run Command Button twGuf Private Sub Command1_Click() Cls n = Text1 If n = 0 Then End sum1 = 0


Contents Microsoft Access 2002

111

uuuGef

For i = 1 To n sum1 = sum1 + 1 / i ^ 2 Next Print "The Sum of the series is "; sum1 End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 134)twdik ;f azmfjyrnfjzpfonf/

yHk(134)

udef;pOfwef; P = (2/3)(3/4)(4/5)...(N/N+1) wdkYudk½SmazGjcif; atmufyg Form yHpk t H m; zefw;D wnfaqmufyg/ yH(k 135)/ 4if;wGif , , rsm;jzifzh efw;D xm;Ny;D Properties toD;oD;udk jyifqifjznfph u G f NyD;aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ yHk(135)

Run Command Button twGuf Private Sub Command1_Click() Cls n = Text1 If n = 0 Or n > 18 Then End pro = 1


Contents Microsoft Access 2002

112

uuuGef

For i = 1 To n pro = pro * (i + 1) / (i + 2) Next Print "The Product of the series is "; pro End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 136)twdik ;f azmfjyrnfjzpfonf/

yHk(136)

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


Contents Microsoft Access 2002

uuuGef

113

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

a&;om;&ef jzpfygonf/

yHk(137)

Command1 Button twGuf Private Sub Command1_Click() Form1.Hide Form2.Show End Sub Command2 Button twGuf Private Sub Command2_Click() Unload Me End End Sub xdaYk emuf Form2 yHpk t H m;zefw;D wnfaqmufxm;&rnf/ yH(k 138)/ 4if;wGif

,

rsm;jzifzh efw;D xm;Ny;D Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm; a&;om;&ef jzpfygonf/ ,

,


Contents Microsoft Access 2002

114

uuuGef

yHk(138)

rSm jzifw h nfaqmufxm;ygonf/ Adodc \ Properties wGif yH(k 139)? yH(k 140)ygtwdik ;f jyifqifxm;&rnf/ (Name) Caption ConnectionString

-

RecordSource

-

Wado Empty PROVIDER = MSDASQL; dsn = Test2; uid=; pwd=; Select [Roll Number], Name, Myanmar, English, Maths, Total from Test2


Contents Microsoft Access 2002

yHk(139)

uuuGef

115

yHk(140)

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


Contents Microsoft Access 2002

116

uuuGef

yHk(141)

RecordSource \ nmzuf Box wGif Cursor csygu Ellipsis trSwt f om;yg Command Button udk Mouse Left Click jzifha½G;cs,fygu yHk(142)ygtwdkif; Property Pages Dialog Box ay:vmrnf/ Command Text (SQL) List Box wGif Cursor xnfyh g/ xdaYk emuf Select [Roll Number], Name,Myanmar,English,Maths, h u G í f OK udak ½G;cs,&f ayrnf/ Total from Test2udjk znfp

yHk(142)


Contents Microsoft Access 2002

117

uuuGef

Text1 Text Box \ Properties wGiaf tmufygtwdi k ;f jyifqifjznfph u G &f efDataSource Wado DataField Roll Number Text Empty k ;f jyifqifjznfph u G &f efText2 Text Box \ Properties wGiaf tmufygtwdi DataSource Wado DataField Name Text Empty k ;f jyifqifjznfph u G &f efText3 Text Box \ Properties wGiaf tmufygtwdi DataSource Wado DataField Myanmar Text Empty Text4 Text Box \ Properties wGiaf tmufygtwdi k ;f jyifqifjznfph u G &f efDataSource Wado DataField English Text Empty Text5 Text Box \ Properties wGiaf tmufygtwdi k ;f jyifqifjznfph u G &f efDataSource Wado DataField Maths Text Empty Text6 Text Box \ Properties wGiaf tmufygtwdi k ;f jyifqifjznfph u G &f efDataSource Wado DataField Total Text Empty k &rfrsm;tm;atmufygtwdik ;f a&;om; Form2 \ Command Button rsm;twGuf y½d*

&rnf/ (3)bmomaygif;jcif; Command Button twGuf Private Sub Command1_Click() Wado.Recordset.MoveFirst Do While Wado.Recordset.EOF = False Wado.Recordset("Total") = Wado.Recordset("Myanmar") + Wado.Recordset("English") + Wado.Recordset("Maths") Wado.Recordset.Update


Contents Microsoft Access 2002

118

uuuGef

Wado.Recordset.MoveNext Loop Wado.Recordset.MoveFirst End Sub rlvae&modkYjyef yefoGm;jcif; Command Button twGuf Private Sub Command2_Click() Form2.Hide Form1.Show End Sub 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 tqdyk gy½d*k &rfukd Run ygu yH(k 143)twdik ;f azmfjyrnfjzpfonf/

yHk(143)


Contents Microsoft Access 2002

119

uuuGef

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

yHk(144)

zdkifzGifjcif; Command Button twGuf Private Sub Command1_Click() Form1.Hide Form2.Show End Sub xGufjcif; Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub xdaYk emuf Form2 yHpk t H m;zefw;D wnfaqmufxm;&rnf/ þuJo h w Ykd nfaqmuf&mwGif Adodc, DataGrid rsm; Toolbox xJwi G ½f &dS efvt kd yfayonf/ Toolbox xJ½Sd Icon vGwaf eaomrsuEf mS jyiftm; Mouse Pointer jzifah xmufí Right Click udak ½G;cs,yf g/ xdt k cg yH(k 145)ygtwdik ;f Short Cut Menu wpfcak y:vmayrnf/


Contents Microsoft Access 2002

uuuGef

120

yHk(145)

yHk(145)yg Short Cut Menu rS Components... udka½G;cs,f&rnf/ xdktcg yH(k 146)ygtwdik ;f Components Dialog Box ay:vmrnf/

yHk(146)

Controls Tab Command acgif;pOfatmuf Vertical Scroll Bar rS Dropdown k oH;k jyKNy;D Adodc ESifh DataGrid wd½Yk o dS nfah e&mrsm;udk Check jyKvyk &f rnf/ Arrow udt

yHk(147)/


Contents Microsoft Access 2002

uuuGef

121

yHk(147)

xdaYk emuf Apply Command Button udak ½G;cs,yf g/ OK ae&m Command Button wGif Close ay:vmygu4if;udka½G;cs,f&rnf/ xdktcg Toolbox xJü Adodc ESifh DataGrid wdYk Icon rsm;a&muf½Sdvmrnf/ yHk(148)/

yHk(148)


Contents Microsoft Access 2002

122

uuuGef

xdaYk emuf Form2 yHpk t H m;zefw;D wnfaqmufxm;&rnf/ yH(k 149)/ 4if;wGif , , , rsm;jzifzh efw;D xm;Ny;D Properties rsm;udjk yifqifjznfph u G f í Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/

yHk(149)

DataGrid \ Properties wGif atmufygwdu Yk jkd yifqifjznfph u G &f ef/ yH(k 150)/ AllowAddnew True AllowArrows True AllowDelete True AllowUpdate True DataSource Wado


Contents Microsoft Access 2002

uuuGef

123

yHk(150)

xdaYk emuf DataGrid ay:odYk Mouse Left Click jzifha½G;cs,fNyD; Mouse Right k yfrH Click udkESdyfyg/ yHk(151)yg Short Cut Menu ay:vmygu Retrieve Fields udx a½G;cs,&f rnf/


Contents Microsoft Access 2002

uuuGef

124

yHk(151)

xdt k cg yH(k 152)yg Retrieve fields Dialog Box ay:vmygu Yes udx k yfraH ½G;cs,yf g/

yHk(152)

yHk(153)ygtwdkif; DataGrid xJwiG f oufqikd &f m Fields udak wGU½S&d ayrnf/


Contents Microsoft Access 2002

125

uuuGef

yHk(153)

(3)bmomaygif;jcif; Command Button twGuf Private Sub Command1_Click() Wado.Recordset.MoveFirst Do While Wado.Recordset.EOF = False Wado.Recordset("Total") = Wado.Recordset("Myanmar") + Wado.Recordset("English") + Wado.Recordset("Maths") Wado.Recordset.Update Wado.Recordset.MoveNext Loop Wado.Recordset.MoveFirst End Sub

rlvae&modkYjyef yefoGm;jcif; Command Button twGuf Private Sub Command2_Click() Form2.Hide Form1.Show End Sub


Contents Microsoft Access 2002

126

uuuGef

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 tqdyk gy½d*k &rfukd Run ygu yH(k 154)twdik ;f azmfjyrnfjzpfonf/

yHk(154)

Access 2002 Database File wGif Field topfxyfxnfhí Update vkyfjcif; Access 2002 Database File jzpfaom Test2.mdb wGif Result, Amount of H nfyh g/ xdaYk emuf Visual Basic 6.0 jzifhy½dk*&rf Fail [lí Field topf(2)ckxyfrx a&;om;rnfqu kd yxrOD;pGmyH(k 155)ygtwdik ;f Form1 udw k nfaqmuf&rnf/


Contents Microsoft Access 2002

uuuGef

127

yHk(155)

txufyg yH(k 155)wGif rsm;jzifzh efw;D xm;Ny;D Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm; a&;om;&ef jzpfygonf/ zdkifzGifjcif; Command Button twGuf Private Sub Command1_Click() Form1.Hide Form2.Show End Sub

xGufjcif; Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub

xdaYk emuf Form2 yHpk t H m; yH(k 156)ygtwdik ;f zefw;D wnfaqmufxm;&rnf/


Contents Microsoft Access 2002

128

uuuGef

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


Contents Microsoft Access 2002

129

ElseIf Wado.Recordset("Myanmar") < 40 And Wado.Recordset("English") >= 40 And Wado.Recordset("Maths") < 40 Then Wado.Recordset("Amount of Fail") = "2" ElseIf Wado.Recordset("Myanmar") >= 40 And Wado.Recordset("English") < 40 And Wado.Recordset("Maths") < 40 Then Wado.Recordset("Amount of Fail") = "2" ElseIf Wado.Recordset("Myanmar") < 40 And Wado.Recordset("English") >= 40 And Wado.Recordset("Maths") >= 40 Then Wado.Recordset("Amount of Fail") = "1" ElseIf Wado.Recordset("Myanmar") >= 40 And Wado.Recordset("English") < 40 And Wado.Recordset("Maths") >= 40 Then Wado.Recordset("Amount of Fail") = "1" ElseIf Wado.Recordset("Myanmar") >= 40 And Wado.Recordset("English") >= 40 And Wado.Recordset("Maths") < 40 Then Wado.Recordset("Amount of Fail") = "1" Else Wado.Recordset("Amount of Fail") = Null End If Wado.Recordset.Update Wado.Recordset.MoveNext b=b+1 Loop Wado.Recordset.MoveFirst Text1.Text = b - 1 End Sub rlvae&mjyefoGm;jcif; Command Button twGuf Private Sub Command2_Click() Form2.Hide Form1.Show End Sub

uuuGef


Contents Microsoft Access 2002

uuuGef

130

tqdyk gy½d*k &rfukd Run ygu yH(k 157)twdik ;f azmfjyrnfjzpfonf/

yHk(157) Access 2002 Database File ½Sd Query File tm;ac:oHk;jcif; Access 2002 Database File jzpfaom Test2.mdb wGif Position [lí Field topf(1)ckxyfrx H nfyh g/ Result Field udk Descending, Amount of Fail Field udk Ascending, Total Field udk Descending jzifp h x D m;aom ptest2 trnf½dS Query k nfaqmufxm;yg/ xdaYk emuf Visual Basic 6.0 jzifyh ½d*k &rfa&;om;rnfqu kd File wpfcw yxrOD;pGmyHk(158)ygtwdkif; Form1 udw k nfaqmuf&rnf/

yHk(158)


Contents 131

Microsoft Access 2002

uuuGef

yHk(158)wGif rsm;jzifhzefwD;xm;NyD; Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm; a&;om;&ef jzpfygonf/ zdkifzGifjcif; Command Button twGuf Private Sub Command1_Click() Form1.Hide Form2.Show End Sub

xGufjcif; Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub

xdaYk emuf Form2 yHpk t H m; yH(k 159)ygtwdik ;f zefw;D wnfaqmufxm;&rnf/

yHk(159)


Contents Microsoft Access 2002

132

uuuGef

Adodc \ Properties wGiaf tmufygwdu Yk jkd yifqifjznfph u G &f ef(Name) Wado Caption Empty ConnectionString PROVIDER = MSDASQL; dsn = Test2; uid=; pwd=; RecordSource Select [Roll Number], Name, Myanmar, English, Maths, Total, Result, [Amount of Fail], Position from ptest2

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


Contents Microsoft Access 2002

133

uuuGef

Wado.Recordset("English") >= 40 And Wado.Recordset("Maths") < 40 Then Wado.Recordset("Amount of Fail") = "2" ElseIf Wado.Recordset("Myanmar") >= 40 And Wado.Recordset("English") < 40 And Wado.Recordset("Maths") < 40 Then Wado.Recordset("Amount of Fail") = "2" ElseIf Wado.Recordset("Myanmar") < 40 And Wado.Recordset("English") >= 40 And Wado.Recordset("Maths") >= 40 Then Wado.Recordset("Amount of Fail") = "1" ElseIf Wado.Recordset("Myanmar") >= 40 And Wado.Recordset("English") < 40 And Wado.Recordset("Maths") >= 40 Then Wado.Recordset("Amount of Fail") = "1" ElseIf Wado.Recordset("Myanmar") >= 40 And Wado.Recordset("English") >= 40 And Wado.Recordset("Maths") < 40 Then Wado.Recordset("Amount of Fail") = "1" Else Wado.Recordset("Amount of Fail") = Null End If If (p = Wado.Recordset("Total") And Wado.Recordset("Result") = "Pass") Or (p = Wado.Recordset("Total") And q = Wado.Recordset("Result") And r = Wado.Recordset("Amount of Fail")) Then Wado.Recordset("Position") = a ElseIf (p = Wado.Recordset("Total") And Wado.Recordset("Result") = "Fail") Then a=a+1 Wado.Recordset("Position") = b a=b Else a=a+1 Wado.Recordset("Position") = b


Contents Microsoft Access 2002

134

uuuGef

a=b End If p = Wado.Recordset("Total") 'Initialize Total q = Wado.Recordset("Result") 'Initialize Result r = Wado.Recordset("Amount of fail") 'Initialize Amount of Fail Wado.Recordset.Update Wado.Recordset.MoveNext b=b+1 Loop Wado.Recordset.MoveFirst Text1.Text = b - 1 End Sub rlvae&mjyefoGm;jcif; jcif; Command Button twGuf Private Sub Command2_Click() Form2.Hide Form1.Show End Sub tqdyk gy½d*k &rfukd Run ygu yH(k 160)twdik ;f azmfjyrnfjzpfonf/

yHk(160) ---------------0-0-0---------------


Contents Microsoft Access 2002

135

uuuGef

tcef;(8) rsm;\*kPfow책drsm; sm; Data Types rsm;\*k Data Type Byte Boolean Integer Long (long integer) Single (single precision floating-point Double (double-precision floating-point

Storage Size 1 byte 2 bytes 2 bytes 4 bytes

Range 0 to 255 True or False -32,768 to 32767 -2,147,483,648 to 2,147,483,647

4 bytes

Currency (scaled integer) Decimal

8 bytes

Date Object String (variable-length) String (fixed-length) Variant (with numbers) Variant (with characters) User-defined (using type)

-3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values -1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values -922,337,203,685,477.5808 to 922,337,203,685,477.5808 +/-79,228,162,514,264,337,593,543,950,335 with no decimal point; +/-79,228,162,514,264,337,593,543,950,335 with 28 places to the right of the decimal point; smallest nonzero number is +/-0.00000000000000000000000000001 January 1, 100 December 31, 9999 Any Object reference 0 to approximately 2 billion

8 bytes 4 bytes 10 bytes + string length Length of string 1 to approximately 65,400

8 bytes

14 bytes

16 bytes

Any numeric value up to the range of a Double

22 bytes +string length Number required by elements

Same range as for variable-length String The range of each element is the same as the range of its data type


Contents Microsoft Access 2002

136

uuuGef

erlemy½dk*&rfrsm;

yHk(161)

yH(k 161)yg Form wGif , , wdjYk zifw h nfaqmuf xm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Text1 TextBox \ Properties rSm Alignment 2 - Center Font MS Sans Serif, Regular, 24 Text Empty Image1 Image \ Properties rSm Picture Phone.wmf Stretch True Display Command Button twGuf Private Sub Command1_Click() Text1.Text = Date End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub


Contents Microsoft Access 2002

137

uuuGef

Form Click twGuf Private Sub Form_Click() Text1.Font.Bold = True End Sub Image1 Click twGuf Private Sub Image1_Click() Image1.Move Image1.Left + 50, Image1.Top - 550 MsgBox "Hello" End Sub ---------------0-0-0---------------

yHk(162)

yHk(162)yg Form wGif , , , wdjYk zifw h nfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Picture1 PictureBox \ Properties rSm (Name) Picture1 AutoSize False Picture "C:\WINDOWS\SETUP.BMP" Text1 TextBox \ Properties rSm Font MS Sans Serif, Regular, 14 Text Empty


Contents Microsoft Access 2002

uuuGef

138

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

yHk(163)


Contents Microsoft Access 2002

139

uuuGef

yHk(163)yg Form wGif , , wdjYk zifw h nf aqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD; wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Text1 TextBox \ Properties rSm Alignment Left Justify Font MS Sans Serif, Regular, 12 Text Empty Add Command Button twGuf Private Sub Command1_Click() List1.AddItem Text1.Text End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------

yHk(164)


Contents Microsoft Access 2002

140

uuuGef

yHk(164)yg Form wGif , , wdjYk zifw h nf aqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD; wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ >> Command Button twGuf Private Sub Command1_Click() Dim i As Integer For i = 0 To List2.ListCount - 1 If List2.Selected(i) Then List1.AddItem List2.List(i) End If Next i For i = List2.ListCount - 1 To 0 Step -1 If List2.Selected(i) Then List2.RemoveItem (i) End If Next i End Sub << Command Button twGuf Private Sub Command2_Click() Dim i As Integer For i = 0 To List1.ListCount - 1 If List1.Selected(i) Then List2.AddItem List1.List(i) End If Next i For i = List1.ListCount - 1 To 0 Step -1 If List1.Selected(i) Then List1.RemoveItem (i) End If Next i End Sub


Contents Microsoft Access 2002

141

Add Command Button twGuf Private Sub Command3_Click() List1.AddItem Text1.Text End Sub Exit Command Button twGuf Private Sub Command4_Click() Unload Me End End Sub ---------------0-0-0--------------Looping Structure Do ... Loop For ... Next For Each ... Next Do While ... Loop Do While <Condition> [Statements] [Exit Do] [Statements] Loop Do Until ... Loop Do Until <Condition> [Statements] [Exit Do] [Statements] Loop Do ... Loop While <Condition> Do [Statements] Loop While <Condition>

uuuGef


Contents Microsoft Access 2002

uuuGef

142

Syntax; If <Condition> Then [Statements] [Else elsestatements] or If <Condition> Then [Statements] [Elseif <Condition-n> Then [elsestatements] ... [Else [elsestatements]] End If ---------------0-0-0---------------

yHk(165)

yHk(165)yg Form wGif wdjYk zifw h nfaqmufxm;Ny;D Properties rsm;udk jyifqifjznfph u G Nf y;D aemuf Command Button toD;oD; wGif vdt k yfaom y½d*k &rfrsm;udk a&;om;&ayrnf/ General, Declaration wGif Private Sub Demoloop() n=1 Do While n <= 10 MsgBox n


Contents Microsoft Access 2002

143

n=n+1 Loop End Sub Private Sub Demoloop1() Dim i As Integer i = 10 Do Until i < 1 MsgBox i i=i-1 If i = 6 Then Exit Do End If Loop End Sub Command1 Command Button twGuf Private Sub Command1_Click() Demoloop End Sub Command2 Command Button twGuf Private Sub Command2_Click() Demoloop1 End Sub For ... Next For Counter = Start To End [Step Increment] [Statements] Next ---------------0-0-0---------------

uuuGef


Contents Microsoft Access 2002

uuuGef

144

yHk(166)

yHk(165)yg Form wGif jzifw h nfaqmufxm;Ny;D Properties rsm;udk jyifqifjznfph u G Nf y;D aemuf Command Button wGif vdt k yfaomy½d*k &rfrsm;udk a&;om;&ay rnf/ Command1 Command Button wGif Private Sub Command1_Click() Unload Me End End Sub Form Click wGif Private Sub Form_Click() Print Screen.FontCount Dim i As Integer For i = 0 To Screen.FontCount Print Screen.Fonts(i) Next End Sub


Contents Microsoft Access 2002

145

uuuGef

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

yHk(167)

yHk(167)yg Form wGif , , wdkYjzifh wnfaqmufxm;Ny;D Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ = Command Button twGuf Private Sub Command1_Click() num1 = Val(Text1.Text) num2 = Val(Text2.Text) Select Case Combo1.Text


Contents Microsoft Access 2002

146

uuuGef

Case "+" Text3.Text = num1 + num2 Case "-" Text3.Text = num1 - num2 Case "*" Text3.Text = num1 * num2 Case "/" Text3.Text = num1 / num2 End Select End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() Combo1.AddItem "+" 'Adding the symbol + Combo1.AddItem "-" 'Adding the symbol Combo1.AddItem "*" 'Adding the symbol * Combo1.AddItem "/" 'Adding the symbol / End Sub ---------------0-0-0---------------

yHk(168)

yH k ( 168)yg Form wGif , , wd k Y j zif h wnfaqmufxm;Ny;D Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/


Contents Microsoft Access 2002

147

uuuGef

Run Command Button twGuf Private Sub Command1_Click() Shape1.Shape = Val(Text1.Text) End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------

yHk(169)

yH(k 169)yg Form wGif , , wdjYk zifh wnfaqmuf xm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ 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


Contents Microsoft Access 2002

148

uuuGef

Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------

yHk(170)

yHk(170)yg Form wGif , , wdjYk zifh wnfaqmuf G Nf y;D aemuf Command Button toD;oD;wGif xm;Ny;D Properties rsm;udjk yifqifjznfph u vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Interval Zero Command Button twGuf Private Sub Command1_Click() Timer1.Interval = 0 End Sub Interval Hundred Command Button twGuf Private Sub Command2_Click() Timer1.Interval = 100 End Sub Exit Command Button twGuf Private Sub Command3_Click() Unload Me End End Sub


Contents Microsoft Access 2002

149

uuuGef

Timer1 Timer twGuf Private Sub Timer1_Timer() Dim i As Integer Label1.Caption = Right(Trim(Label1.Caption), Len(Trim(Label1 .Caption)) - 1) + Trim(Left(Label1.Caption, 1)) End Sub ---------------0-0-0--------------Toolbox wGifyg0ifaom Icon rsm;ESifherlemy½dk*&rfrsm; Pointer

PictureBox

Label

TextBox

Frame

Command Button

CheckBox

OptionButton

ComboBox

ListBox

HScrollBar

VScrollBar

Timer

DriveListBox

DirListBox

FileListBox

Shape

Line

Image

DataControl

OLE


Contents Microsoft Access 2002

uuuGef

150

yHk(171)

yHk(171)yg Form wGif

FileListBox,

DriveListBox,

DirListBox,

wdjYk zifh wnfaqmufxm;Ny;D Properties rsm;udkjyifqif jznfhpGufNyD;aemuf Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om; &ayrnf/ Image1 Image Properties twGuf Image,

(Name) Image1 Stretch True File FileListBox Properties twGuf (Name) File1 Pattern *.bmp;*.jpg;*.gif;*.pic;*.tif;*.ico Show Command Button twGuf Private Sub Command1_Click() Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName) End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub


Contents

uuuGef

151

Microsoft Access 2002

Directory Change &eftwGuf Private Sub Dir1_Change() File1.Path = Dir1.Path End Sub Drive Change &eftwGuf Private Sub Drive1_Change() Dir1.Path = Drive1.Drive End Sub ---------------0-0-0---------------

yHk(172)

yHk(172)yg Form wGif

Frame ,

Shape,

HScrollBar,

CheckBox, OptionButton, wd k Y j zif h wnfaqmufxm;Ny;D Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button VScrollBar,

toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om; &ayrnf/ Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub


Contents

uuuGef

152

Microsoft Access 2002 Horizontal Scroll Bar twGuf Private Sub HScroll1_Change() Shape1.Width = HScroll1.Value End Sub Vertical Scroll Bar twGuf Private Sub VScroll1_Change() Shape1.Height = VScroll1.Value End Sub Option1 Button twGuf Private Sub Option1_Click() If Option1.Value Then Shape1.Shape = 0 End If End Sub Option2 Button twGuf Private Sub Option2_Click() If Option2.Value Then Shape1.Shape = 2 End If End Sub Option3 Button twGuf Private Sub Option3_Click() If Option3.Value Then Shape1.Shape = 4 End If End Sub Shape1 - Fill Style 0 Solid 1 Transparent 2 Horizontal Line 3 Vertical Line

4 5 6 7

Upward Diagonal Downward Diagonal Cross Diagonal Cross


Contents Microsoft Access 2002

uuuGef

153

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

yHk(173)

yHk(173)yg Form wGif

TextBox,

Timer,

wdjYk zifh wnf

G Nf y;D aemuf Command Button toD;oD; aqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Text1, Text2 TextBox Properties twGuf Alignment 2 - Center Font MS Sans Serif, 14, Bold Text Empty Timer1 Timer Properties twGuf (Name) Timer1 Interval 1000 Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() Text1.Text = Time$ Text2.Text = Date$ End Sub


Contents Microsoft Access 2002

uuuGef

154

Timer1 twGuf Private Sub Timer1_Timer() Text1.Text = Time$ End Sub rivate Sub Command1_Click() Unload Me End End Sub ---------------0-0-0---------------

yHk(174)

yHk(174)yg Form wGif TextBox, wdjYk zifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfp h u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaom y½dk*&rfrsm;udka&;om;&ayrnf/ Text1, Text2, Text3, Text4 TextBox Properties twGuf Alignment 2 - Center Font MS Sans Serif, 14, Bold Text Empty Command1 Command Button twGuf Private Sub Command1_Click() Dim MyDate As Date MyDate = Format(Text1.Text, "D-MMMM-YY") Text2.Text = Format(MyDate, "dddd") Text3.Text = Text2.Text End Sub


Contents Microsoft Access 2002

uuuGef

155

Command2 Command Button twGuf Private Sub Command2_Click() Text4.Text = Format(Text3.Text, ">") End Sub Exit Command Button twGuf Private Sub Command3_Click() Unload Me End End Sub ---------------0-0-0---------------

yHk(175)

yHk(175)yg Form wGif Label, TextBox, wdjYk zifh wnf aqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD; wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Text1, Text2 TextBox Properties twGuf Alignment 2 - Center Font MS Sans Serif, 12, Bold Text Empty Command1 Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub


Contents Microsoft Access 2002

uuuGef

156

Text1 wGif Data xnfhonfESifh Text2 wGiftajzay:&eftwGuf Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer) Text2.Text = (Text1.Text * 9 / 5) + 32 End Sub Text2 wGif Data xnfhonfESifh Text1 wGiftajzay:&eftwGuf Private Sub Text2_KeyUp(KeyCode As Integer, Shift As Integer) Text1.Text = (Text2.Text - 32) * 5 / 9 End Sub ---------------0-0-0---------------

yHk(176)

yHk(176)yg Form wGif Label, TextBox, wdjYk zifh wnf aqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Select Command Button wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Label1 Label Properties twGuf (Name) Label1 AutoSize True BackStyle Transparent Caption Empty Text1 TextBox Properties twGuf Alignment 2 - Center Font MS Sans Serif, 12, Bold Text Empty Command1 Command Button twGuf Private Sub Command1_Click() Dim n As Integer n = Val(Text1.Text) If n <= 2 Then Select Case Text1.Text Case 0


Contents Microsoft Access 2002

uuuGef

157

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

yHk(177)

yHk(177)yg Form wGif TextBox, ComboBox, wdkY jzifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Text1 TextBox Properties twGuf Alignment 2 - Center Font MS Sans Serif, 8, Bold Text Empty Add Command Button twGuf Private Sub Command1_Click() Combo1.AddItem Text1.Text Text1.Text = Empty Command2.Enabled = True End Sub


Contents Microsoft Access 2002

158

uuuGef

Delete Command Button twGuf Private Sub Command2_Click() n = Combo1.ListIndex If n <> -1 Then Combo1.RemoveItem n End If End Sub Exit Command Button twGuf Private Sub Command3_Click() Unload Me End End Sub ---------------0-0-0---------------

yHk(178)

yHk(178)yg Form wGif OptionButton, wdjYk zifw h nfaqmuf xm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Option Button, Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Option Button1 twGuf Private Sub Option1_Click() Form1.BackColor = QBColor(2) End Sub


Contents

uuuGef

159

Microsoft Access 2002 Option Button2 twGuf Private Sub Option2_Click() Form1.BackColor = QBColor(5) End Sub Option Button3 twGuf Private Sub Option3_Click() Form1.BackColor = QBColor(0) End Sub Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub

Syntax; QBColor(<Color>) MyForm.BackColor = QBColor(ColorCode) 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---------------


Contents Microsoft Access 2002

160

uuuGef

yHk(179)

yHk(179)yg Form wGif OptionButton, wdjYk zifw h nfaqmuf xm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Option Button, Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Option Button1 twGuf Private Sub Option1_Click() Form1.BackColor = QBColor(0) End Sub Option Button2 twGuf Private Sub Option2_Click() Form1.BackColor = QBColor(1) End Sub Option Button3 twGuf Private Sub Option3_Click() Form1.BackColor = QBColor(2) End Sub Option Button4 twGuf Private Sub Option4_Click() Form1.BackColor = QBColor(3) End Sub Option Button5 twGuf Private Sub Option5_Click() Form1.BackColor = QBColor(4) End Sub


Contents Microsoft Access 2002

161

Option Button6 twGuf Private Sub Option6_Click() Form1.BackColor = QBColor(5) End Sub Option Button7 twGuf Private Sub Option7_Click() Form1.BackColor = QBColor(6) End Sub Option Button8 twGuf Private Sub Option8_Click() Form1.BackColor = QBColor(7) End Sub Option Button9 twGuf Private Sub Option9_Click() Form1.BackColor = QBColor(8) End Sub Option Button10 twGuf Private Sub Option10_Click() Form1.BackColor = QBColor(9) End Sub Option Button11 twGuf Private Sub Option11_Click() Form1.BackColor = QBColor(10) End Sub Option Button12 twGuf Private Sub Option12_Click() Form1.BackColor = QBColor(11) End Sub Option Button13 twGuf Private Sub Option13_Click() Form1.BackColor = QBColor(12) End Sub

uuuGef


Contents Microsoft Access 2002

uuuGef

162

Option Button14 twGuf Private Sub Option14_Click() Form1.BackColor = QBColor(13) End Sub Option Button15 twGuf Private Sub Option15_Click() Form1.BackColor = QBColor(14) End Sub Option Button16 twGuf Private Sub Option16_Click() Form1.BackColor = QBColor(15) End Sub Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub ---------------0-0-0---------------

yHk(180)

yH(k 180)yg Form wGif CheckBox, wdjYk zifw h nfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfp h u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaom y½dk*&rfrsm;udka&;om;&ayrnf/


Contents Microsoft Access 2002

uuuGef

163

Run Command Button twGuf Private Sub Command1_Click() If Check1.Value = 1 And Check2.Value = 1 And Check3.Value = 1 Then MsgBox "Eligible for the Housing Loan", , "Housing Loan" Else MsgBox "Not Eligible for the Housing Loan" End If End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------

yHk(181)

yHk(181)yg Form wGif wdjYk zifw h nfaqmufxm;Ny;D Properties rsm; udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaomy½d*k &rfrsm;udk a&;om;&ayrnf/ Run Command Button twGuf Private Sub Command1_Click() Dim ret_date As Date ret_date = InputBox("Enter the Date of Joining", "Date of Joining") If ret_date > Date Then MsgBox "Invalid Date! Re-enter" Else MsgBox "Date is Valid"


Contents Microsoft Access 2002

164

uuuGef

End If End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------

yHk(182)

yH(k 182)yg Form wGif Fans, Music System wdu Yk kd Menu Editor... jzifv h nf;aumif; TextBox, wdjYk zifv h nf;aumif;wnfaqmufxm;Ny;D Properties rsm;udk jyifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaomy½d*k &rfrsm; udk a&;om;&ayrnf/ General, Declaration wGif Dim LastItem As Integer Menu Editor Dialog Box wGif Caption &Fans Name Fans Caption &Music System Name mnMusic mnMusic \ Properties udk yH(k 183)ygtwdi k ;f Index tm; 0 (Zero) xm;ay;&rnf/ xdrk o S m y½d*k &rf Run í&ayrnf/


Contents Microsoft Access 2002

uuuGef

165

yHk(183)

Run Command Button twGuf Private Sub Command1_Click() lastitem = lastitem + 1 If lastitem > 10 Then MsgBox "Limit Exceeded" Else Load mnMusic(lastitem) mnMusic(lastitem).Caption = Text1.Text End If End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub

tqdyk g y½d*k &rfukd Run ygu yH(k 184)ygtwdik ;f jrifawGU&ayrnf/


Contents Microsoft Access 2002

166

uuuGef

yHk(184)

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

yHk(185)

yHk(185)yg Form wGif File, Add, Delete, Exit wdu Yk kd Menu Editor... jzifv h nf; aumif;? TextBox, wdkYjzifhvnf;aumif;wnfaqmufxm;NyD; Properties rsm;udjk yifqifjznfp h u G Nf y;D aemuf Command Button toD;oD;wGiv f t kd yfaom y½dk*&rfrsm;udk a&;om;&ayrnf/ Menu Editor Dialog Box wGif Caption &File &Add &Delete E&xit

Name mnFile mnAdd mnDelete mnExit mnSep


Contents Microsoft Access 2002

167

uuuGef

mnSep udk Caption a&;&efrvdkyg/ Name wGio f m mnSep [kowfrw S í f 4if; Properties \ Index wGif 0 (Zero) ay;&ayrnf/ General, Declaration wGif Dim LastItem As Integer Form Load wGif Private Sub Form_Load() LastItem = 0 mnDelete.Enabled = False End Sub Add Menu twGuf Private Sub mnAdd_Click(Index As Integer) LastItem = LastItem + 1 Load mnSep(LastItem) mnSep(LastItem).Caption = "ITEM" + Str(LastItem) mnDelete.Enabled = True End Sub Delete Menu twGuf Private Sub mnDelete_Click() Unload mnSep(LastItem) LastItem = LastItem - 1 If LastItem = 0 Then mnDelete.Enabled = False End If End Sub Exit Menu twGuf Private Sub mnExit_Click() Unload Me End End Sub mnSep Click twGuf Private Sub mnSep_Click(Index As Integer) MsgBox "The selected item is " + Str(Index) End Sub tqdyk g y½d*k &rfukd Run ygu yH(k 186)ygtwdik ;f jrifawGU&ayrnf/


Contents Microsoft Access 2002

uuuGef

168

yHk(186)

Add Menu udak ½G;ygu ITEM rsm;wdk;vmNyD; Delete Menu a½G;ygu ITEM rsm;

ysuo f mG ;onfuakd wGU½S&d ayrnf/ ---------------0-0-0---------------

yHk(187)

yHk(187)yg Form wGif OptionButton, , wdkYjzifhvnf;aumif;wnfaqmufxm;NyD; Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD ; oD ; wG i f v d k t yf a om y½d k * &rf r sm;ud k a&;om;&ayrnf / CommonDialog Control udk Toolbox twGi;f odq Yk w GJ if&mwGif Toolbox EIwcf rf;om; vGwaf eaomae&mwpfcu k kd Mouse Pointer ñTeí f Right Click ESyd yf g/ yH(k 188)ygtwdik ;f Short Cut Menu wpfcak y:vmrnf/


Contents Microsoft Access 2002

uuuGef

169

yHk(188)

yHk(188)wGif Components... udx k yfraH ½G;cs,yf g/ xdt k cg Components Dialog Box ay:vmrnf/ yH(k 189)/ 4if;rS Microsoft Common Dialog Control 6.0 udak ½G;cs,f NyD; Apply Command Button udak ½G;cs,yf g/ xdaYk emuf Close Command Button udk xyfraH ½G;cs,&f rnf/

yHk(189)

xdt k cg Toolbox wGif yH(k 190)ygtwdik ;f CommonDialog Control a&muf½v dS m ayrnf/


Contents Microsoft Access 2002

uuuGef

170

yHk(190)

Option1 Option Properties wGif Index udk 0 (Zero) [kowfrw S &f rnf/ Run Command Button twGuf Private Sub Command1_Click() If Option1(0).Value Then CommonDialog1.ShowOpen ElseIf Option1(1).Value Then CommonDialog1.ShowSave ElseIf Option1(2).Value Then CommonDialog1.ShowColor End If End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub 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


Contents Microsoft Access 2002

uuuGef

171

Option1(0).Caption = "Open" Option1(1).Caption = "Save" Option1(2).Caption = "Color" Command1.Caption = "Show Dlg" F = True End If End Sub txufyg y½d*k &rfukd Run ygu atmufygtwdik ;f jrifawGU&rnf/ yH(k 191)/

yHk(191)

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

yHk(192)


Contents Microsoft Access 2002

172

uuuGef

yHk(192)yg Form wGif File, Points, Line, Clear, Exit wdu Yk kd Menu Editor... jzifh vnf;aumif;? vIy½f mS ;&rnft h csed u f mvudk

Timer wdjYk zifv h nf;aumif; wnfaqmuf

xm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Pulldown Menu toD;oD;wGiv f t kd yf aom y½d*k &rfrsm;udk a&;om;&ayrnf/ Timer1 Timer Properties wGif Interval 100 Caption Name &File mnFile ...&Points mnPoints ...&Lines mnLines ...&Clear mnClear ...mnSep ...E&xit mnExit General, Declaration wGif Dim Points Form Load twGuf Private Sub Form_Load() Points = 0 End Sub Clear Pulldown Menu twGuf Private Sub mnClear_Click() Points = 0 Form1.Cls End Sub Exit Pulldown Menu twGuf Private Sub mnExit_Click() Unload Me End End Sub


Contents Microsoft Access 2002

173

uuuGef

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

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

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


Contents Microsoft Access 2002

uuuGef

174

yHk(193)

yHk(192)yg Form wGif Command Button wpfcw k nf;jzifo h mwnfaqmufxm;Ny;D vdt k yfaom y½d*k &rfrsm;udk a&;om;&ayrnf/ Form udk Click vkyfygujzpfay:vm&eftwGuf Private Sub Form_Click() Dim i ScaleHeight = 8 For i = 0 To 5 DrawStyle = i Line (0, i + 1)-(ScaleWidth, i + 1) Next End Sub Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub

tqdyk gy½d*k &rfukd Run Ny;D Form xJukd Mouse Left Click vkyyf gu yH(k 194)ygtwdik ;f jrifawGU&rnf/


Contents Microsoft Access 2002

uuuGef

175

yHk(194)

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

yHk(195)

yHk(195)yg Form wGif Command Button wpfcw k nf;jzifo h mwnfaqmufxm;Ny;D vdt k yfaom y½d*k &rfrsm;udk a&;om;&ayrnf/ Form udk Click vkyfygujzpfay:vm&eftwGuf Private Sub Form_Click() Dim CX, CY, Radius ScaleMode = 3 CX = ScaleWidth / 2 CY = ScaleHeight / 2 If CX > CY Then Limit = CY Else Limit = CX


Contents Microsoft Access 2002

uuuGef

176

For Radius = 0 To Limit Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255) Next End Sub Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub

tqdyk gy½d*k &rfukd Run Ny;D Form xJukd Mouse Left Click vkyyf gu yH(k 196)ygtwdik ;f jrifawGU&rnf/

yHk(196)

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


Contents Microsoft Access 2002

177

uuuGef

yHk(197)

yHk(197)yg TextBox, wdjYk zifv h nf;aumif;wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfp h u G Nf y;D aemuf Command Button toD;oD;wGiv f t kd yfaom y½dk*&rfrsm;udk a&;om;&ayrnf/ Text1 TextBox Properties wGif (Name) Text1 Alignment Left Justify MultiLine True Form Click jyKvkyf&eftwGuf Private Sub Form_Click() filenum = FreeFile Open "C:\Setupxlg.txt" For Input As filenum Text1.Text = Input(LOF(filenum), filenum) Close filenum End Sub Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub


Contents Microsoft Access 2002

uuuGef

178

tqdyk gy½d*k &rfukd Run Ny;D Form xJukd Mouse Left Click vkyyf gu yH(k 198)ygtwdik ;f jrifawGU&rnf/

yHk(198)

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

yHk(199)

yHk(199)yg Form yHpk w H iG f

Label,

TextBox,

Frame,

Combo


Contents Microsoft Access 2002

179

uuuGef

Box, CheckBox, wdkYjzifhvnf;aumif;wnfaqmufxm;NyD; Properties rsm;udjk yifqifjznfp h u G Nf y;D aemuf Command Button toD;oD;wGiv f t kd yfaom

y½dk*&rfrsm;udk a&;om;&ayrnf/ Combo1 Combo Properties wGif Text Fonts List Arial, Tahoma, Times, Times New Roman Combo2 Combo Properties wGif Text Style List Regular, Bold, Italic, Bold Italic Combo3 Combo Properties wGif Text Size List 8, 10, 12, 14, 16, 18, 20 General, Declaration wGif 'h represents actual height of the form 'f represents actual height of the frame Dim f, h As Integer 'the variable f and h are declared globally Checkl twGuf Private Sub Check1_Click() 'Executes when check box Underline is checked If (Check1.Value = 1) Then Label2.FontUnderline = True Else Label2.FontUnderline = False End If End Sub Check2 twGuf Private Sub Check2_Click() 'Executes when check box Strike Through is checked If (Check2.Value = 1) Then Label2.FontStrikethru = True Else Label2.FontStrikethru = False End If End Sub


Contents Microsoft Access 2002

180

uuuGef

Combol1 twGuf Private Sub Combo1_LostFocus() 'Executes after you selected font name Label2.FontName = Combo1.Text End Sub Combol2 twGuf Private Sub Combo2_Change() 'Executes after you selected font style If Combo2.Text = "Italic " Or Combo2.Text = "BoldItalic " Then Label2.FontItalic = True Label2.FontBold = False Else Label2.FontItalic = False Label2.FontBold = True End If End Sub Combol3 twGuf Private Sub Combo3_Change() 'Executes after you selected font size Label2.FontSize = Val(Combo3.Text) End Sub Font Command Button twGuf Private Sub Command1_Click() 'Executes when font button is clicked Form1.Height = h 'Initial form height after you click on font button Frame1.Visible = True End Sub Preview Command Button twGuf Private Sub Command2_Click() 'Executes after you selected Ok button Text1.FontName = Label2.FontName Text1.FontSize = Label2.FontSize If Label2.FontItalic = True Then Text1.FontBold = False


Contents Microsoft Access 2002

181

uuuGef

Text1.FontItalic = True Else Text1.FontBold = True Text1.FontItalic = False End If If (Check1.Value = 1) Then Text1.FontUnderline = True Else Text1.FontUnderline = False End If If (Check2.Value = 1) Then Text1.FontStrikethru = True Else Text1.FontStrikethru = False End If End Sub Exit Command Button twGuf Private Sub Command3_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() h = Form1.Height f = Frame1.Height Frame1.Visible = False Form1.Height = h - f 'Initial form height before you click on font button End Sub Text1 Change twGuf Private Sub Text1_Change() Label2.Caption = Text1.Text End Sub ---------------0-0-0---------------


Contents Microsoft Access 2002

182

uuuGef

yHk(200)

H iG f Label, TextBox, wdkYjzifh yHk(200)yg Form yHpk w wnfaqmufxm;Ny;D Properties rsm;udkjyifqifjznfhpGufNyD;aemuf Command Button toD;oD;wGiv f t kd yfaom y½d*k &rfrsm;udk a&;om;&ayrnf/ Calculate - Command Button1 twGuf Private Sub Command1_Click() Text4.Text = Val(Text1.Text) - Val(Text2.Text) + Val(Text3.Text) End Sub Exit - Command Button2 twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------


Contents Microsoft Access 2002

uuuGef

183

yHk(201)

yHk(201)yg Form yHkpHwGif

DirListBox,

FileListBox,

DriveList

wdjYk zifw h nfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGiv f t kd yfaom y½d*k &rfrsm; udka&;om;&ayrnf/ File1 FileListBox - Properties wGif Box,

Label,

Image,

(Name) File1 Pattern *.bmp;*.pic;*.jpg;*.gif;*.wmf;*.tif Label1 Label - Properties wGif (Name) Label1 AutoSize False Caption Empty BorderStyle 1 - Fixed Single WordWrap True Image1 Image - Properties wGif (Name) Image1 Stretch True


Contents Microsoft Access 2002

184

uuuGef

Directory Change twGuf Private Sub Dir1_Change() File1.FileName = Dir1.Path End Sub File a½G;&eftwGuf Private Sub File1_Click() Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName) Label1.Caption = Dir1.Path & "\" & File1.FileName End Sub Exit - Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

uuuGef

185

yHk(202)

yHk(202)yg Form yHpk w H iG f TextBox, ListBox, Command Button wdjYk zifw h nfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGiv f t kd yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ General, Declaration wGif Dim i As Integer Add Command Button twGuf Private Sub command1_Click() List1.AddItem (Text1.Text) End Sub Delete Command Button twGuf Private Sub Command2_Click() List1.RemoveItem (i) End Sub Clear Command Button twGuf Private Sub Command3_Click() List1.Clear End Sub Exit Command Button twGuf Private Sub Command4_Click() Unload Me End End Sub ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

uuuGef

186

yHk(203)

c:\windows\system\mschrt20.ocx yHk(202)yg Form yHpk w H iG f ,

Command Button wdjYk zifw h nfaqmuf

xm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Run Command Button twGuf Private Sub Command1_Click() With Form1.MSChart1 .chartType = VtChChartType3dArea .ColumnCount = 10 .RowCount = 10 For Column = 1 To 10 For Row = 1 To 10


Contents Microsoft Visual Basic 6.0

187

uuuGef

.Column = Column .Row = Row Next Row Next Column End With End Sub Exit Command Button twGuf Private Sub Command4_Click() Unload Me End End Sub txufygy½d*k &rfukd Run ygu yHk(204)ygtwdkif;jrifawGU&ayrnf/

yHk(204) yHk(203)

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


Contents Microsoft Visual Basic 6.0

188

uuuGef

SS Tab c:\windows\system\tabctl32.ocx

yHk(205)


Contents Microsoft Visual Basic 6.0

uuuGef

189

yHk(206)

yHk(206)yg Form yHkpHwGif

,

,

Label,

TextBox,

Command Button wdjYk zifh wnfaqmufxm;Ny;D Properties rsm; udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGiv f t kd yfaom y½d*k &rfrsm;udk CheckBox,

a&;om;&ayrnf/ Check1 twGuf Private Sub Check1_Click() If Check1.Value = vbChecked Then MSChart1.ShowLegend = True Else MSChart1.ShowLegend = False End If End Sub Refresh Command Button twGuf Private Sub Command1_Click() MSChart1.Row = 1 MSChart1.Column = 1


Contents Microsoft Visual Basic 6.0

190

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 MSChart1.Column = 3 MSChart1.Data = Text7.Text MSChart1.Row = 2 MSChart1.Column = 3 MSChart1.Data = Text8.Text MSChart1.Row = 3 MSChart1.Column = 3 MSChart1.Data = Text9.Text End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------

uuuGef


Contents Microsoft Visual Basic 6.0

191

uuuGef

MSFlexGrid c:\windows\system\msflxgrd.ocx

yHk(207)

yHk(207)yg Form yHkpHwGif , Command Button wd k Y j zif h wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;wGif vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ MSFlexGrid1 MSFlexGrid Properties twGuf Cols 13 Rows 13 Add Command Button twGuf Private Sub Command1_Click() Form1.Caption = "Addition Program" Dim x, y For x = 1 To 12 Step 1 MSFlexGrid1.Row = x For y = 1 To 12 Step 1 MSFlexGrid1.Col = y


Contents Microsoft Visual Basic 6.0

192

MSFlexGrid1.Text = x + y Next Next End Sub Subtract Command Button twGuf Private Sub Command2_Click() Form1.Caption = "Subtraction Program" Dim x, y For x = 1 To 12 Step 1 MSFlexGrid1.Row = x For y = 1 To 12 Step 1 MSFlexGrid1.Col = y MSFlexGrid1.Text = x - y Next Next End Sub Division Command Button twGuf Private Sub Command3_Click() Form1.Caption = "Division Program" Dim x, y For x = 1 To 12 Step 1 MSFlexGrid1.Row = x For y = 1 To 12 Step 1 MSFlexGrid1.Col = y MSFlexGrid1.Text = x / y Next Next End Sub Multiplication Command Button twGuf Private Sub Command4_Click() Form1.Caption = "Multiplication Program" Dim x, y For x = 1 To 12 Step 1 MSFlexGrid1.Row = x For y = 1 To 12 Step 1

uuuGef


Contents Microsoft Visual Basic 6.0

193

uuuGef

MSFlexGrid1.Col = y MSFlexGrid1.Text = x * y Next Next End Sub Grid Line Width Command Button twGuf Private Sub Command5_Click() If MSFlexGrid1.GridLineWidth < 4 Then MSFlexGrid1.GridLineWidth = MSFlexGrid1.GridLineWidth + 1 Else MSFlexGrid1.GridLineWidth = 1 End If End Sub Exit Command Button twGuf Private Sub Command6_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() Dim a As Integer MSFlexGrid1.Row = 0 For a = 1 To 12 MSFlexGrid1.Col = a MSFlexGrid1.Text = Str(a) Next MSFlexGrid1.Col = 0 For a = 1 To 12 MSFlexGrid1.Row = a MSFlexGrid1.Text = Str(a) Next End Sub


Contents Microsoft Visual Basic 6.0

194

uuuGef

yH(k 207)yg Form yHpk H Program udk Run yguatmufygtwdik ;f jrifawGU&rnf/ yH(k 208)/

yHk(208)

Add Command Button udak ½G;cs,y f gu yH(k 209)ygtwdik ;f jrifawGU&rnf/

yHk(209)


Contents Microsoft Visual Basic 6.0

195

uuuGef

Subtract Command Button udak ½G;cs,y f gu yH(k 210)ygtwdik ;f jrifawGU&rnf/

yHk(210)

Division Command Button udak ½G;cs,y f gu yH(k 211)ygtwdik ;f jrifawGU&rnf/

yHk(211)


Contents Microsoft Visual Basic 6.0

196

uuuGef

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

yHk(212)

Grid Line Width Command Button udak ½G;cs,y f guyH(k 213)ygtwdik ;f jrifawGU&

rnf/

yHk(213)

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


Contents Microsoft Visual Basic 6.0

197

uuuGef

yHk(214)

yHk(214)yg Form yHkpHwGif , Label, Command Button wdjYk zifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Butk yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ ton toD;oD;wGif vdt Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() MSFlexGrid1.Cols = 6 MSFlexGrid1.Rows = 7 End Sub Grid Line Change &eftwGuf Private Sub MSFlexGrid1_RowColChange() Msg = "Active Cell: " & Chr(64 + MSFlexGrid1.Col) Msg = Msg & MSFlexGrid1.Row Label1.Caption = Msg End Sub

tqdyk g y½d*k &rfukd Run NyD; rdrdtvdk½Sd&m Row (or) Column wdu Yk akd ½G;cs,yf gu Grid Line Cell tuGu½ f dS Cell Reference udk yHk(215)ygtwdkif;azmfjyvdrfhrnf/


Contents Microsoft Visual Basic 6.0

198

uuuGef

yHk(215)

---------------0-0-0--------------RichTextBox c:\windows\system\richtx32.ocx

yHk(216) yHk(216)yg Form yHkpHwGif , Command Button wdjYk zifw h nf aqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD; wGiv f t kd yfaom y½d*k &rfrsm;udak &;om;&ayrnf/


Contents Microsoft Visual Basic 6.0

199

uuuGef

RichTextBox1 - RichTextBox Properties twGuf (Name) RichTextBox1 Font MS Sans Serif, Bold, 12 ScrollBars 3 - rtfBoth RichTextBox2 - RichTextBox Properties twGuf (Name) RichTextBox2 Font MS Sans Serif, Regular, 8 ScrollBars 3 - rtfBoth Add Text Command Button twGuf Private Sub Command1_Click() RichTextBox2.Text = RichTextBox2.Text & RichTextBox1.SelText End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() RichTextBox1.FileName = "c:\tm.rtf" End Sub txufyg y½d*k &rfukd Run ygu yHk(217)ygtwdkif;awGUjrif&rnf/

yHk(217)


Contents Microsoft Visual Basic 6.0

200

uuuGef

yH(k 217)yg b,fbufwiG ½f adS eaompmom;tm; Selected Text vkyNf y;D ? yH(k 218)? Add f gu yH(k 219)ygtwdik ;f jzpfay:vmrnf/ Text Command Button udak ½G;cs,y

yHk(218)

yHk(219)

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


Contents Microsoft Visual Basic 6.0

201

uuuGef

CommonDialog c:\windows\system\comdlg32.ocx

yHk(220)

yHk(220)yg Form yHkpHwGif , , Command h nfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf ComButton wdjYk zifw f t kd yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ mand Button toD;oD;wGiv Open File Command Button twGuf Private Sub Command1_Click() CommonDialog1.DialogTitle = "Open File" CommonDialog1.Filter = "Text File|*.txt|Rich Text File|*.rtf" CommonDialog1.ShowOpen If CommonDialog1.FilterIndex = 1 Then RichTextBox1.LoadFile CommonDialog1.FileName, rtfText Else RichTextBox1.LoadFile CommonDialog1.FileName, rtfRTF End If Me.Caption = CommonDialog1.FileName End Sub


Contents Microsoft Visual Basic 6.0

202

uuuGef

Save File Command Button twGuf Private Sub Command2_Click() CommonDialog1.Filter = "Text File|*.txt|Rich Text File|*.rtf" CommonDialog1.ShowSave If CommonDialog1.FilterIndex = 1 Then RichTextBox1.SaveFile CommonDialog1.FileName, rtfText Else RichTextBox1.SaveFile CommonDialog1.FileName, rtfRTF End If End Sub Fonts Command Button twGuf Private Sub Command3_Click() CommonDialog1.Flags = cdlCFEffects + cdlCFBoth CommonDialog1.ShowFont With RichTextBox1 .SelBold = CommonDialog1.FontBold .SelFontName = CommonDialog1.Name .SelFontSize = CommonDialog1.FontSize .SelItalic = CommonDialog1.FontItalic .SelStrikeThru = CommonDialog1.FontStrikethru .SelUnderline = CommonDialog1.FontUnderline .SelColor = CommonDialog1.Color End With End Sub Exit Command Button twGuf Private Sub Command4_Click() Unload Me End End Sub Form tus,ftusOf;jyKvkyf&eftwGuf Private Sub Form_Resize() If Me.WindowState = vbMinimized Then Exit Sub RichTextBox1.Height = Me.Height - 1260 RichTextBox1.Width = Me.Width - 285


Contents Microsoft Visual Basic 6.0

203

uuuGef

Command1.Top = Me.Height - 915 Command2.Top = Me.Height - 915 Command3.Top = Me.Height - 915 Command4.Top = Me.Height - 915 End Sub Form Load twGuf Private Sub Form_Load() Form1.Caption = "Sample 36" End Sub tqdyk g y½d*k &rfukd Run yguyH(k 221)ygtwdik ;f jrifawGU&rnf/

yHk(221) Open File Command Button udak ½G;cs,y f gu yH(k 222)ygtwdik ;f jrifawGU&rnf/


Contents Microsoft Visual Basic 6.0

204

uuuGef

yHk(222)

txufyg Dialog Box wGif Files of type: nmzuf½dS List Box ü Dropdown udak ½G;cs,yf gu Text File ESihf Rich Text Format File trsK;d tpm; Arrow jzpfaom (2)ckxrJ S BuKu d &f mzdik t f rsK;d tpm;udk a½G;cs,í f Open Command Button udak ½G;cs,yf gu a½G;cs,fjcif;cH&aom *.txt (or) *.rtf File rsm;yGifhvmayrnf/ yHk(223)/

yHk(223)

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


Contents Microsoft Visual Basic 6.0

uuuGef

205

Microsoft Windows Common Controls wGifyg0ifaom Icon rsm; c:\windows\system\mscomctl.ocx TabStrip Toolbar

StatusBar

ProgressBar

TreeView

ListView

ImageList

Slider

ImageCombo

yHk(224)

yHk(224)yg Form yHkpHwGif TextBox, Toolbar, Command Button wdjYk zifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Butk yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ ton toD;oD;wGif vdt Text1 - Text Properties twGuf (Name) Text1 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font MS Sans Serif, Regular, 10 MultiLine True ScrollBar 3 - Both Toolbar1 - Toolbar Properties twGuf (Name) Toolbar1 Alignment 0 - vbAlignNone BorderStyle 1 - ccFixedSingle


Contents Microsoft Visual Basic 6.0

206

uuuGef

Form yHp k t H wGi;f ½Sd Toolbar udak ½G;cs,í f Right Click ESyd yf g/ xdaYk emuf Properties udak ½G;cs,yf gu yH(k 225)ygtwdik ;f Property Pages Dialog Box ay:vmrnf/

yHk(225)

Property Pages Dialog Box xJ½dS General, Buttons, Picture Tab Command Button (3)ck x J r S Buttons Tab Command Button ud k a ½G ; cs,f y g/ xd k Y a emuf

4if;xJwiG yf g0ifaomtcsut f vufrsm;tm; atmufygtwdik ;f jyifqifjznfph u G &f ef Index Caption Key Tag 1 Cut Button1 1 2 Copy Button2 2 3 Paste Button3 3 Toolbar xJ½Sd Button rsm;twGuf Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) Select Case Button.Key Case "Button2": Clipboard.Clear Clipboard.SetText Text1.SelText


Contents Microsoft Visual Basic 6.0

207

uuuGef

Case "Button1": Clipboard.Clear Clipboard.SetText Text1.SelText Text1.Text = " " Case "Button3": Text1.SelText = Clipboard.GetText() End Select End Sub Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub tqdyk g y½d*k &rfukd Run NyD; Text Box xJwiG f pmrsm;½du k Ef ydS í f rdrt d vd½k &dS mpmrsm;udk Selected Text (or) Drag jyKvy k u f m ul;jcif;? jzwfjcif;? uyfjcif;wdu Yk akd qmif½u G Ef ikd yf gonf/ y½d*k &rfxrJ S xGuv f ykd gu Exit Command Button udak ½G;cs,&f efjzpfygonf/ ---------------0-0-0---------------

yHk(226)

yHk(226)yg Form yHkpHwGif Toolbar, StatusBar, Command Button wdjYk zifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Butk yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ ton toD;oD;wGif vdt


Contents Microsoft Visual Basic 6.0

208

uuuGef

Toolbar1 - Toolbar Properties twGuf (Name) Toolbar1 Align 1 - vbAlignTop Index Caption Key Tag 1 Subject One Sub1 1 2 Subject Two Sub2 2 3 Subject Three Sub3 3 4 Subject Four Sub4 4 StatusBar1 - StatusBar Properties twGuf (Name) StatusBar1 Align 2 - vbAlignBottom Add Button Command Button twGuf Private Sub Command1_Click() Static i As Integer Dim c As String i=i+1 c = InputBox("Enter Button Title") Toolbar1.Buttons.Add i, , c End Sub Private Sub Command1_GotFocus() StatusBar1.Panels(1).Text = "Click to Add a Button of the Toolbar" End Sub Delete Button Command Button twGuf Private Sub Command2_Click() Dim i As Integer i = InputBox("Enter Button No. to Delete") Toolbar1.Buttons.Remove i End Sub Private Sub Command2_GotFocus() StatusBar1.Panels(1).Text = "Click to Delete a Button from the Toolbar" End Sub Add Panel Command Button twGuf Private Sub Command3_Click() Static i As Integer Dim c As String


Contents Microsoft Visual Basic 6.0

209

uuuGef

i=i+1 If StatusBar1.Panels.Count = 16 Then MsgBox "You can add only 16 Panels in a Status Bar" Exit Sub End If c = InputBox("Enter Panel Title") StatusBar1.Panels.Add i, , c StatusBar1.Panels(i).AutoSize = sbrSpring End Sub Private Sub Command3_GotFocus() StatusBar1.Panels(1).Text = "Click to Add a Panel to the Status Bar" End Sub Delete Panel Command Button twGuf Private Sub Command4_Click() Dim i As Integer i = InputBox("Enter Panel No. to Delete") StatusBar1.Panels.Remove i End Sub Private Sub Command4_GotFocus() StatusBar1.Panels(1).Text="Click to Delete a Panel from the Status Bar" End Sub Exit Command Button twGuf Private Sub Command5_Click() Unload Me End End Sub Status Bar Panel Click twGuf Private Sub StatusBar1_PanelClick(ByVal Panel As MSComctlLib.Panel) MsgBox "You have Clicked" & Panel.Text End Sub Tool Bar Button Click twGuf Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) MsgBox "You have Clicked" & Button.Caption End Sub


Contents Microsoft Visual Basic 6.0

210

uuuGef

txufyg y½d*k &rfukd Run NyD; Add Button udak ½G;cs,yf gu Enter Button Title \acgif;pOfatmuf List Box wGif rdrt d vd½k &dS mpmom;ud½k u kd Ef ydS Nf y;D OK udak ½G;cs,yf g/ yHk(227)? yHk(228)/

yHk(227)

yHk(228)

Delete Button udak ½G;cs,y f gu Enter Button No. to Delete \acgif;pOfatmuf List Box wGif rdrzd ,f½mS ;vdo k nft h rSwpf Ofu½kd u kd Ef ydS Nf y;D OK udak ½G;cs,yf g/ yH(k 229)? yH(k 230)/


Contents Microsoft Visual Basic 6.0

211

uuuGef

yHk(229)

yHk(230)

Add Panel udak ½G;cs,y f gu Enter Panel Title \acgif;pOfatmuf List Box wGif rdrt d vd½k &dS mpmom;ud½k u kd Ef ydS Nf y;D OK udka½G;cs,fyg/ yHk(231)? yHk(232)/


Contents Microsoft Visual Basic 6.0

212

uuuGef

yHk(231)

yHk(232)

DeletePanel udak ½G;cs,y f gu Enter Button No. to Delete \acgif;pOfatmuf List Box wGif rdrzd ,f½mS ;vdo k nft h rSwpf Ofu½kd u kd Ef ydS Nf y;D OK udak ½G;cs,yf g/ yH(k 233)? yH(k 234)/


Contents Microsoft Visual Basic 6.0

213

uuuGef

yHk(233)

yHk(234)

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


Contents Microsoft Visual Basic 6.0

214

uuuGef

yHk(235)

yHk(235)yg Form yHkpHwGif ProgressBar, Command Button wdjYk zifh wnf aqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD; wGiv f t kd yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ ProgressBar1 - ProgressBar Properties twGuf (Name) ProgressBar1 Align 0 - vbAlignNone BorderStyle 1 - ccFixedSingle Max 30000 Min 1 Run Command Button twGuf Private Sub Command1_Click() Dim n1 As Integer For n1 = 1 To 30000 Form1.Caption = "Processing Step " & Trim$(CStr(n1)) & " of 30000" ProgressBar1 = n1 Next n1 End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

215

uuuGef

yHk(236)

yHk(235)yg Form yHkpHwGif Slider, TextBox, Command Button wdYk jzifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Butf t kd yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ ton toD;oD;wGiv Form Load twGuf Private Sub Form_Load() Text1.Width = 6000 'Set a minimum width for the TextBox Slider1.Left = Text1.Left 'Align the Slider to the TextBox 'Match the width of the Slider to the TextBox Slider1.Max = Text1.Width 'Place the Slider a little below the TextBox Slider1.Top = Text1.Top + Text1.Height + 50 'Set tickfrequency to a fraction of the Max value Slider1.TickFrequency = Slider1.Max * 0.1 'SetLargeChange and SmallChange value to a fraction of Max Slider1.LargeChange = Slider1.Max * 0.1 Slider1.SmallChange = Slider1.Max * 0.01 End Sub Slider1 Change twGuf Private Sub Slider1_Change() 'If the slider is under 1/3 the size of the textbox, no change. 'Else, match the width of the textbox to the Slider's value If Slider1.Value > Slider1.Max / 3 Then Text1.Width = Slider1.Value End If End Sub


Contents Microsoft Visual Basic 6.0

uuuGef

216

Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub tqdyk g y½d*k &rfukd Run yguyH(k 237)ygtwdik ;f jrifawGU&rnfjzpfNy;D Slider \twd;k ^ tavsmah jymif;Munfyh gu Text Box tus,^f tusO;f jzpfomG ;onfukd jrifawGU&ayrnf/

yHk(237)

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

yHk(238)

yHk(238)yg Form yHkpHwGif ImageList, PictureBox, Command h u G Nf y;D aemuf ComButton wdYk jzifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfp f t kd yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ mand Button toD;oD;wGiv


Contents Microsoft Visual Basic 6.0

217

uuuGef

Picture1 - PictureBox Properties twGuf (Name) Picture1 Align None AutoSize True BorderStyle 1 - Fixed Single Form yHkpHtwGif;½Sd ImageList udka½G;cs,fí Right Click ESdyfyg/ xdkYaemuf Properties udak ½G;cs,y f gu yH(k 239)ygtwdik ;f Property Pages Dialog Box ay:vmrnf/

yHk(239)

Property Pages Dialog Box xJ½dS General, Images, Color Tab Command f g/ xdaYk emuf 4if;xJwiG f Button (3)ckxJrS Images Tab Command Button udak ½G;cs,y yg0ifaom Insert Picture... Command Button udak ½G;cs,yf g/ xdt k cg rdrt d vd½k o dS nfh *.bmp File (odr Yk [kw)f *.ico File ½So d nfh vrf;aMumif;rsm;ud½k mS azGa½G;cs,í f zdik rf sm;tm;

qJw G if&rnf/ yH(k 240)/


Contents Microsoft Visual Basic 6.0

uuuGef

218

yHk(240)

yHk(240)wGif Open udak ½G;cs,yf gu yH(k 239)wGiaf zmfjyxm;onft h wdik ;f Club.bmp hf nf/ txufyg y½d*k &rfukd Run ygu rdrt d vd½k o dS nfh Image qJw G ifvkd File a&mufomG ;vdrr ygu &½Srd nfjzpfygonf/ yH(k 241)/

yHk(241)

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


Contents Microsoft Visual Basic 6.0

uuuGef

219

yHk(242)

yHk(242)yg Form yHkpHwGif TabStrip, TextBox, Command Button wdjYk zifh wnfaqmufxm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Butf t kd yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ ton ESifh Tab toD;oD;twGuv Form yHp k t H wGi;f ½Sd TabStrip udak ½G;cs,í f Right Click ESdyfyg/ xdkYaemuf Properf gu yH(k 243)ygtwdik ;f Property Pages Dialog Box ay:vmrnf/ ties udak ½G;cs,y

yHk(243)


Contents Microsoft Visual Basic 6.0

220

uuuGef

Property Pages Dialog Box xJ½dS General, Tabs, Font, Picture Command f g/ xdaYk emuf 4if;xJwiG f Button (4)ckxJrS Tabs Tab Command Button udak ½G;cs,y

yg0ifaomtcsut f vufrsm;udk atmufygtwdik ;f jznfph u G &f ef Index Caption Tag 1 Department One 2 Items Two 3 Branches Three Tab Command Button rsm; Click vkyf&eftwGuf Private Sub TabStrip1_Click() If TabStrip1.SelectedItem.Tag = "One" Then Text1.Text = "Sales Department" Text2.Text = "Purchase Department" Text3.Text = "Admin Department" ElseIf TabStrip1.SelectedItem.Tag = "Two" Then Text1.Text = "Keyboard" Text2.Text = "Monitor" Text3.Text = "Hard Disk" ElseIf TabStrip1.SelectedItem.Tag = "Three" Then Text1.Text = "London" Text2.Text = "New York" Text3.Text = "Singapore" End If End Sub Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub

tqdyk g y½d*k &rfukd Run yguyH(k 244)ygtwdik ;f jrifawGU&rnf/


Contents Microsoft Visual Basic 6.0

uuuGef

221

yHk(244)

yHk(244)wGif Tab Command Button wpfcjk zpfaom Department udak ½G;cs,yf gu yH(k 245)ygtwdik ;f Department ESiq hf ikd af omXmersm;udk azmfjyrnfjzpfonf/

yHk(245)

yHk(245)wGif Tab Command Button wpfckjzpfaom Items udka½G;cs,fygu yH(k 246)ygtwdik ;f Item ESiq hf ikd af omudp&ö yfrsm;udk azmfjyrnfjzpfonf/


Contents Microsoft Visual Basic 6.0

uuuGef

222

yHk(246)

yHk(246)wGif Tab Command Button wpfcjk zpfaom Branches udak ½G;cs,yf gu yHk(247)ygtwdkif; Branches ESiq hf ikd af omudp&ö yfrsm;udk azmfjyrnfjzpfonf/

yHk(247)

þy½d*k &rfxrJ S xGuv f ykd gu Command Button wpfcjk zpfaom Exit udak ½G;cs,&f efjzpf ygonf/ ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

223

uuuGef

Microsoft Calendar Control (Form twGif;jyu©'defxnfhjcif;) c:\windows\system\mscal.ocx

yHk(248)

yH(k 248)yg Form yHpk w H iG f Calendar, Command Button wdjYk zifh wnfaqmuf xm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button twGuv f t kd yf aom y½d*k &rfrsm;udak &;om;&ayrnf/ Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub

tqdyk g y½d*k &rfukd Run ygu ,aeYwiG ½f adS ernfh &uf? v? ckEpS f jyu©'ed u f akd zmfjyrnf jzpfonf/ ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

224

uuuGef

Execute File udk y½dk*&rfjzifhvSrf;ac:toHk;jyKjcif;

yHk(249)

yHk(249)yg Form yHkpHwGif OLE, Command Button wdjYk zifh wnfaqmuf xm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button toD;oD;twGuf vdt k yfaom y½d*k &rfrsm;udak &;om;&ayrnf/ Call Indirect Command Button twGuf Private Sub Command1_Click() OLE1.CreateLink "c:\pm65\pm65.exe" End Sub Call Direct Command Button twGuf Private Sub Command2_Click() Call Shell("c:\pm65\pm65.exe c:\vb6\vb601.p65", 1) End Sub Exit Command Button twGuf Private Sub Command3_Click() Unload Me End End Sub

tqdyk g y½d*k &rfukd Run ygu yH(k 250)ygtwdik ;f jrifawGU&rnf/


Contents Microsoft Visual Basic 6.0

uuuGef

225

yHk(250)

txufygyHk(250)wGif Call Indirect Command Button Sub udka½G;cs,fygu yHk(251)ygtwdkif;azmfjyrnf/

yHk(251)

yHk(251)wGif OLE Box xJoaYkd &mufaeaom Page Maker 6.5 Icon tm; Double Click ESdyfjcif;jzifh Page Maker 6.5 Application Package Run vmayrnf/ Call Direct Command Button udak ½G;cs,jf cif;jzifh Page Maker 6.5 Application h jyif c:\vb6\vb601.p65 zdik yf gwdu k ½f u kd yf iG v hf mNy;D tvd½k &dS mjyKvyk f Package Run vmrnft Edik af yrnf/ 4if;y½d*k &rfrx S u G v f ykd gu Exit Command Button tm;a½G;cs,&f efjzpfonf/ ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

226

uuuGef

jr§m;rsm;udkywfjcmvnfvSnfhonfhy½dk*&rfudka&;jcif;

yHk(252)

yHk(248)yg Form yHpk w H iG f Image, Command Button wdjYk zifh wnfaqmuf xm;Ny;D Properties rsm;udjk yifqifjznfph u G Nf y;D aemuf Command Button rsm;twGuv f t kd yf aom y½d*k &rfrsm;udak &;om;&ayrnf/ Form1 - Form Properties wGif WindowState 2 - Maximized General wGif Private Sub rotate() For t = 0 To 100 Next End Sub Run Command Button twGuf Private Sub Command1_Click() For k = 1 To 10 'Call Shell("c:\windows\mplayer.exe c:\MyDocu~1\Romance.wav",1) Image1.Left = 0 Image1.Top = 0 Image1.Visible = True Image2.Visible = False Image3.Visible = False Image4.Visible = False


Contents Microsoft Visual Basic 6.0

227

i = Image1.Left j = Image1.Top For i = 0 To 11500 Step 1 rotate Image1.Move Image1.Left + 1, Image1.Top Next i Image1.Left = 0 Image1.Top = 0 '''''''''''''' Image2.Left = 11500 Image2.Top = 0 Image1.Visible = False Image2.Visible = True Image3.Visible = False Image4.Visible = False For j = 0 To 8300 Step 1 rotate Image2.Move Image2.Left, Image2.Top + 1 Next j Image2.Left = 11500 Image2.Top = 0 '''''''''''''' Image3.Left = 11500 Image3.Top = 8300 Image1.Visible = False Image2.Visible = False Image3.Visible = True Image4.Visible = False For j = 11500 To 0 Step -1 rotate Image3.Move Image3.Left - 1, Image3.Top Next j Image3.Left = 11500 Image3.Top = 8300 ''''''''''''''

uuuGef


Contents Microsoft Visual Basic 6.0

228

uuuGef

Image4.Left = 0 Image4.Top = 8300 Image1.Visible = False Image2.Visible = False Image3.Visible = False Image4.Visible = True For j = 8300 To 0 Step -1 rotate Image4.Move Image4.Left, Image4.Top - 1 Next j Image4.Left = 0 Image4.Top = 8300 Print: Print: Print " ", k: Beep Next k Image1.Left = 0 Image1.Top = 0 Image1.Visible = True Image2.Visible = False Image3.Visible = False Image4.Visible = False End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub

tqdyk g y½d*k &rfukd Run ygu jrm§ ;wpfpif;onf vufsm;&pf(10)Burd yf wfaeonfukd jrifawGU&vdrrhf nf/ ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

uuuGef

229

tcef;(9) Access 2002 ½Sd Database File xJrS Table File wpfcktm;zGifhjcif; atmufyg Form yHkpH(2)cktm; zefwD;wnfaqmufxm;&rnf/ yHk(253)? yHk(254)/

yHk(253)

yHk(254)


Contents 230

Microsoft Visual Basic 6.0

uuuGef

yH(k 253)yg Form yHpk w H iG f rsm;jzifzh efw;D xm;Ny;D Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ Open File Command Button twGuf Private Sub Command1_Click() Form1.Hide Form2.Show End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub xdaYk emuf Form2 yHpk t H m;zefw;D wnfaqmufxm;&rnf/ yH(k 254)/ 4if;wGif

,

rsm;jzifzh efw;D xm;Ny;D oufqikd f &m Properties rsm;wGijf yifqifjznfph u G Nf y;D aemuf Command Button rsm;wGif vdt k yfaom y½dk*&rfrsm;a&;om;&ef jzpfygonf/ Label1, 2, 3, 4, 5, 6, 7, 8 wGifyg0ifMuaom Properties rsm;twGuf ,

,

,

Alignment 0 - Left Justify AutoSize True BackStyle 0 - Transparent BorderStyle 0 - None Font MS Sans Serif, Bold, 8 Text1 - TextBox Properties twGuf (Name) Text1 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Roll Number DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text2 - TextBox Properties twGuf (Name) Text2 Alignment 0 - Left Justify


Contents Microsoft Visual Basic 6.0

231

BorderStyle 1 - Fixed Single DataField Name DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text3 - TextBox Properties twGuf (Name) Text3 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Myanmar DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text4 - TextBox Properties twGuf (Name) Text4 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField English DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text5 - TextBox Properties twGuf (Name) Text5 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Maths DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text6 - TextBox Properties twGuf (Name) Text6 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Total

uuuGef


Contents Microsoft Visual Basic 6.0

232

uuuGef

DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text7 - TextBox Properties twGuf (Name) Text7 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Result DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text8 - TextBox Properties twGuf (Name) Text8 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Amount of Fail DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Adodc1 - Adodc Properties twGuf (Name) Adodc1 Align 0 - vbAlignNone BOFAction 0 - adDoMoveFirst ConnectingString provider=msdasql;dsn=exam01;uid=;pwd=; EOFAction 0 - adDoMoveLast Font MS Sans Serif, Bold, 8 RecordSource select [Roll Number], Name, Myanmar, English, Maths,Total,Result,[Amount of Fail] from exam01 order by [Roll Number] DataGrid1 - DataGrid Properties twGuf (Name) DataGrid1 Align 0 - vbAlignNone AllowAddNew True AllowArrows True


Contents Microsoft Visual Basic 6.0

233

uuuGef

AllowDelete True AllowUpdate True DataSource Adodc1 Font MS Sans Serif, Bold, 8 Form rSxGufoGm;aomtcg Mouse Pointer yHkrSefjyefjzpf&eftwGuf Private Sub Form_Unload(Cancel As Integer) Screen.MousePointer = vbDefault End Sub Record Position od&eftwGuf Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.Event ReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Adodc1.Caption = "Record: " & CStr(Adodc1.Recordset. AbsolutePosition) End Sub Add Command Button twGuf Private Sub Command1_Click() Adodc1.Recordset.AddNew End Sub Update Command Button twGuf Private Sub Command2_Click() Adodc1.Recordset.UpdateBatch adAffectAll End Sub Delete Command Button twGuf Private Sub Command3_Click() With Adodc1.Recordset .Delete .MoveNext If .EOF Then .MoveLast End With End Sub


Contents Microsoft Visual Basic 6.0

234

uuuGef

Refresh Command Button twGuf Private Sub Command4_Click() Adodc1.Refresh End Sub Close Command Button twGuf Private Sub Command5_Click() Form2.Hide Form1.Show End Sub tqdyk g y½d*k &rfukd Run ygu yH(k 255)ygtwdik ;f jrifawGU&rnfjzpfonf/

yHk(255)

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


Contents Microsoft Visual Basic 6.0

235

uuuGef

k rJ S Table File ESpcf t k m; Updating jyKvyk jf cif; Access 2002 ½Sd Database File wpfcx atmufyg Form yHpk (H 3)cktm; zefw;D wnfaqmufxm;&rnf/ yH(k 256)? yH(k 257)? yH(k 258)/

yHk(256)

yHk(257)


Contents Microsoft Visual Basic 6.0

236

uuuGef

yHk(258)

yHk(256)yg Form yHkpHwGif rsm;jzifhzefwD;xm;NyD; Command Butk yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ ton rsm;wGif vdt (9)wef;(u)zdkif Command Button twGuf Private Sub Command1_Click() Form1.Hide Form2.Show End Sub (9)wef;(c)zdkif Command Button twGuf Private Sub Command1_Click() Form1.Hide Form3.Show End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me


Contents Microsoft Visual Basic 6.0

237

uuuGef

End End Sub

xdaYk emuf Form2, Form3 yHkpHtm;zefwD;wnfaqmufxm;&rnf/ yHk(257)? yHk(258)/ 4if;wGif , , , , rsm;jzifh zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ Button rsm;wGif vdt Label1, 2, 3, 4, 5, 6, 7, 8 wGifyg0ifMuaom Properties rsm;twGuf Alignment 0 - Left Justify AutoSize True BackStyle 0 - Transparent BorderStyle 0 - None Font MS Sans Serif, Bold, 8 Text1 - TextBox Properties twGuf (Name) Text1 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Roll Number DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text2 - TextBox Properties twGuf (Name) Text2 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Name DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text3 - TextBox Properties twGuf (Name) Text3 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Myanmar DataFormat General


Contents Microsoft Visual Basic 6.0

238

DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text4 - TextBox Properties twGuf (Name) Text4 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField English DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text5 - TextBox Properties twGuf (Name) Text5 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Maths DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text6 - TextBox Properties twGuf (Name) Text6 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Total DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Text7 - TextBox Properties twGuf (Name) Text7 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Result DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8

uuuGef


Contents Microsoft Visual Basic 6.0

239

uuuGef

Text8 - TextBox Properties twGuf (Name) Text8 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Amount of Fail DataFormat General DataSource Adodc1 Font MS Sans Serif, Bold, 8 Adodc1 - Adodc Properties twGuf (Name) Adodc1 Align 0 - vbAlignNone BOFAction 0 - adDoMoveFirst ConnectingString provider=msdasql;dsn=exam01;uid=;pwd=; EOFAction 0 - adDoMoveLast Font MS Sans Serif, Bold, 8 RecordSource select [Roll Number], Name, Myanmar, English, Maths,Total,Result,[Amount of Fail] from exam01 order by [Roll Number][Form2 twGuf] RecordSource select [Roll Number], Name, Myanmar, English, Maths,Total,Result,[Amount of Fail] from exam02 order by [Roll Number][Form3 twGuf] DataGrid1 - DataGrid Properties twGuf (Name) DataGrid1 Align 0 - vbAlignNone AllowAddNew True AllowArrows True AllowDelete True AllowUpdate True DataSource Adodc1 Font MS Sans Serif, Bold, 8 Form rSxGufoGm;aomtcg Mouse Pointer yHkrSefjyefjzpf&eftwGuf Private Sub Form_Unload(Cancel As Integer) Screen.MousePointer = vbDefault End Sub


Contents Microsoft Visual Basic 6.0

240

uuuGef

Record Position od&eftwGuf Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.Event ReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Adodc1.Caption = "Record: " & CStr(Adodc1.Recordset. AbsolutePosition) End Sub (3)bmomaygif;jcif; Command Button twGuf Private Sub Command1_Click() Adodc1.Recordset.MoveFirst Do While Adodc1.Recordset.EOF = False Adodc1.Recordset("Total") = Adodc1.Recordset("Myanmar") + Adodc1.Recordset("English") + Adodc1.Recordset("Maths") If Adodc1.Recordset("Myanmar") < 40 Or Adodc1.Recordset ("English") < 40 Or Adodc1.Recordset("Maths") < 40 Then Adodc1.Recordset("Result") = "Fail" Else Adodc1.Recordset("Result") = "Pass" End If If Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset ("English") < 40 And Adodc1.Recordset("Maths") < 40 Then Adodc1.Recordset("Amount of Fail") = "3" ElseIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset ("English") < 40 And Adodc1.Recordset("Maths") >= 40 Then Adodc1.Recordset("Amount of Fail") = "2" ElseIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset ("English") >= 40 And Adodc1.Recordset("Maths") < 40 Then Adodc1.Recordset("Amount of Fail") = "2" ElseIf Adodc1.Recordset("Myanmar") >= 40 And Adodc1.Recordset ("English") < 40 And Adodc1.Recordset("Maths") < 40 Then Adodc1.Recordset("Amount of Fail") = "2" ElseIf Adodc1.Recordset("Myanmar") < 40 And Adodc1.Recordset ("English") >= 40 And Adodc1.Recordset("Maths") >= 40 Then


Contents Microsoft Visual Basic 6.0

241

uuuGef

Adodc1.Recordset("Amount of Fail") = "1" ElseIf Adodc1.Recordset("Myanmar") >= 40 And Adodc1.Recordset ("English") < 40 And Adodc1.Recordset("Maths") >= 40 Then Adodc1.Recordset("Amount of Fail") = "1" ElseIf Adodc1.Recordset("Myanmar") >= 40 And Adodc1.Recordset ("English") >= 40 And Adodc1.Recordset("Maths") < 40 Then Adodc1.Recordset("Amount of Fail") = "1" Else Adodc1.Recordset("Amount of Fail") = Null End If Adodc1.Recordset.Update Adodc1.Recordset.MoveNext Loop Adodc1.Recordset.MoveFirst End Sub rlvae&modkYjyef yefoGm;jcif; Command Button twGuf - [Form2 twGuf] Private Sub Command2_Click() Form2.Hide Form1.Show End Sub rlvae&modkYjyef yefoGm;jcif; Command Button twGuf - [Form3 twGuf] Private Sub Command2_Click() Form3.Hide Form1.Show End Sub ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

242

uuuGef

k rJ S Table File rsm;tm; Form wpfcjk zifzh iG jhf cif; Access 2002 ½Sd Database File wpfcx atmufyg Form yHpk t H m; zefw;D wnfaqmufxm;&rnf/ yH(k 259)/

yHk(259) , , rsm;jzifh yHk(259)yg Form yHkpHwGif zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ Button rsm;wGif vdt a1 - Adodc Properties twGuf (Name) Align BOFAction ConnectingString EOFAction Font RecordSource

-

a1 0 - vbAlignNone 0 - adDoMoveFirst provider=msdasql;dsn=exam01;uid=;pwd=; 0 - adDoMoveLast MS Sans Serif, Bold, 8 select [Roll Number], Name, Myanmar, English, Maths,Total,Result,[Amount of Fail] from exam01 order by [Roll Number]


Contents Microsoft Visual Basic 6.0

243

uuuGef

a2 - Adodc Properties twGuf (Name) a2 Align 0 - vbAlignNone BOFAction 0 - adDoMoveFirst ConnectingString provider=msdasql;dsn=exam01;uid=;pwd=; EOFAction 0 - adDoMoveLast Font MS Sans Serif, Bold, 8 RecordSource select [Roll Number], Name, Myanmar, English, Maths,Total,Result,[Amount of Fail] from exam02 order by [Roll Number] a3 - Adodc Properties twGuf (Name) a3 Align 0 - vbAlignNone BOFAction 0 - adDoMoveFirst ConnectingString provider=msdasql;dsn=exam01;uid=;pwd=; EOFAction 0 - adDoMoveLast Font MS Sans Serif, Bold, 8 RecordSource select [Roll Number], Name, Myanmar, English, Maths,Total,Result,[Amount of Fail] from exam03 order by [Roll Number] DataGrid1 - DataGrid Properties twGuf (Name) DataGrid1 Align 0 - vbAlignNone AllowAddNew True AllowArrows True AllowDelete True AllowUpdate True Font MS Sans Serif, Bold, 8 A1 - Adodc \ Record Position twGuf Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event StatusEnum, ByVal pRecordset As ADODB.Recordset) a1.Caption = "Record: " & CStr(a1.Recordset.AbsolutePosition) End Sub


Contents Microsoft Visual Basic 6.0

244

uuuGef

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 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 File One Command Button twGuf Private Sub Command1_Click() Set DataGrid1.DataSource = a1 a1.Left = 2880 a1.Top = 4440 a2.Left = 2640 a2.Top = 5760 a3.Left = 5160 a3.Top = 5760 Form1.Height = 5985 Form1.Caption = "Standard 9th, Section (A)" End Sub File Two Command Button twGuf Private Sub Command2_Click() Set DataGrid1.DataSource = a2 a1.Left = 120 a1.Top = 5760 a2.Left = 2880 a2.Top = 4440 a3.Left = 5160 a3.Top = 5760 Form1.Height = 5985


Contents Microsoft Visual Basic 6.0

245

Form1.Caption = "Standard 9th, Section (B)" End Sub File Three Command Button twGuf Private Sub Command3_Click() Set DataGrid1.DataSource = a3 a1.Left = 120 a1.Top = 5760 a2.Left = 2640 a2.Top = 5760 a3.Left = 2880 a3.Top = 4440 Form1.Height = 5985 Form1.Caption = "Standard 9th, Section (C)" End Sub Exit Command Button twGuf Private Sub Command4_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() Form1.Height = 6975 End Sub ---------------0-0-0---------------

uuuGef


Contents Microsoft Visual Basic 6.0

246

uuuGef

J S Table File trsm;pktm; Form wpfcjk zifh Access 2002 ½Sd Database File trsm;pkxr zGifhjcif; atmufyg Form yHpk t H m; zefw;D wnfaqmufxm;&rnf/ yH(k 260)/

yHk(260) yHk(260)yg Form yHkpHwGif , , rsm;jzifh zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ Button rsm;wGif vdt a1 - Adodc Properties twGuf (Name) Align BOFAction ConnectingString EOFAction Font

-

a1 0 - vbAlignNone 0 - adDoMoveFirst provider=msdasql;dsn=Test1;uid=;pwd=; 0 - adDoMoveLast MS Sans Serif, Bold, 8


Contents Microsoft Visual Basic 6.0 RecordSource

-

247

uuuGef

select [Identification Number],Rank,Name, Department from Test1 order by [Identification Number]

a2 - Adodc Properties twGuf (Name) a2 Align 0 - vbAlignNone BOFAction 0 - adDoMoveFirst ConnectingString provider=msdasql;dsn=exam02;uid=;pwd=; EOFAction 0 - adDoMoveLast Font MS Sans Serif, Bold, 8 RecordSource select [Roll Number], Name, Myanmar, English, Maths,Total,Result,[Amount of Fail] from exam02 order by [Roll Number] a3 - Adodc Properties twGuf (Name) a3 Align 0 - vbAlignNone BOFAction 0 - adDoMoveFirst ConnectingString provider=msdasql;dsn=exam01;uid=;pwd=; EOFAction 0 - adDoMoveLast Font MS Sans Serif, Bold, 8 RecordSource select [Roll Number], Name, Myanmar, English, Maths,Total,Result,[Amount of Fail] from exam03 order by [Roll Number] DataGrid1 - DataGrid Properties twGuf (Name) DataGrid1 Align 0 - vbAlignNone AllowAddNew True AllowArrows True AllowDelete True AllowUpdate True Font MS Sans Serif, Bold, 8


Contents Microsoft Visual Basic 6.0

248

uuuGef

A1 - Adodc \ Record Position twGuf Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event StatusEnum, ByVal pRecordset As ADODB.Recordset) a1.Caption = "Record: " & CStr(a1.Recordset.AbsolutePosition) End Sub 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 A3 - Adodc \ Record Position twGuf Private Sub a3_MoveComplete(ByVal adReason As ADODB.EventReason Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event StatusEnum, ByVal pRecordset As ADODB.Recordset) a3.Caption = "Record: " & CStr(a3.Recordset.AbsolutePosition) End Sub File One Command Button twGuf Private Sub Command1_Click() Set DataGrid1.DataSource = a1 a1.Left = 2880 a1.Top = 4440 a2.Left = 2640 a2.Top = 5760 a3.Left = 5160 a3.Top = 5760 Form1.Height = 5985 Form1.Caption = "Economic File (Table File) from Test1.mdb" End Sub File Two Command Button twGuf Private Sub Command2_Click() Set DataGrid1.DataSource = a2 a1.Left = 120


Contents Microsoft Visual Basic 6.0

249

uuuGef

a1.Top = 5760 a2.Left = 2880 a2.Top = 4440 a3.Left = 5160 a3.Top = 5760 Form1.Height = 5985 Form1.Caption = "Standard 9th, Section (B) (Table File) from exam02.mdb" End Sub File Three Command Button twGuf Private Sub Command3_Click() Set DataGrid1.DataSource = a3 a1.Left = 120 a1.Top = 5760 a2.Left = 2640 a2.Top = 5760 a3.Left = 2880 a3.Top = 4440 Form1.Height = 5985 Form1.Caption = "Standard 9th, Section (C) (Table File) from exam01.mdb" End Sub Exit Command Button twGuf Private Sub Command4_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() Form1.Height = 6975 End Sub

tqdyk g y½d*k &rfukd Run ygu yHk(261)? (262)? (263)ygtwdkif;jrifawGU&rnf/


Contents Microsoft Visual Basic 6.0

250

yHk(261)

yHk(262)

uuuGef


Contents Microsoft Visual Basic 6.0

251

yHk(263) ---------------0-0-0---------------

uuuGef


Contents Microsoft Visual Basic 6.0

252

uuuGef

Access 2002 ½Sd Database File twGif;rS Table File rsm;tm; Form wpfckjzifh Append jyKvkyfjcif; atmufyg Form yHpk t H m; zefw;D wnfaqmufxm;&rnf/ yH(k 264)/

yHk(264) , , rsm;jzifh yHk(264)yg Form yHkpHwGif zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ Button rsm;wGif vdt a1 - Adodc Properties twGuf (Name) Align BOFAction ConnectingString EOFAction Font RecordSource

-

a1 0 - vbAlignNone 0 - adDoMoveFirst provider=msdasql;dsn=exam01;uid=;pwd=; 0 - adDoMoveLast MS Sans Serif, Bold, 8 select [Identification Number],Rank,Name, Department from Test1 order by [Identification Number]


Contents Microsoft Visual Basic 6.0

253

uuuGef

a2 - Adodc Properties twGuf (Name) a2 Align 0 - vbAlignNone BOFAction 0 - adDoMoveFirst ConnectingString provider=msdasql;dsn=exam02;uid=;pwd=; EOFAction 0 - adDoMoveLast Font MS Sans Serif, Bold, 8 RecordSource select [Roll Number], Name, Myanmar, English, Maths,Total,Result,[Amount of Fail] from Test1 order by [Roll Number] DataGrid1 - DataGrid Properties twGuf (Name) DataGrid1 Align 0 - vbAlignNone AllowAddNew False AllowArrows False AllowDelete False AllowUpdate False Font MS Sans Serif, Bold, 8 DataSource a1 DataGrid2 - DataGrid Properties twGuf (Name) DataGrid2 Align 0 - vbAlignNone AllowAddNew True AllowArrows True AllowDelete True AllowUpdate True Font MS Sans Serif, Bold, 8 DataSource a2 A1 - Adodc \ Record Position twGuf Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event StatusEnum, ByVal pRecordset As ADODB.Recordset) a1.Caption = "Record: " & CStr(a1.Recordset.AbsolutePosition) End Sub


Contents Microsoft Visual Basic 6.0

254

uuuGef

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 To Append Table File Button twGuf Private Sub Command1_Click() Set DataGrid1.DataSource = a1 a1.Recordset.MoveFirst Do While a1.Recordset.EOF = False a2.Recordset.AddNew z01 = a1.Recordset("Identification Number") z02 = a1.Recordset("Rank") z03 = a1.Recordset("Name") z04 = a1.Recordset("Department") a2.Recordset("Identification Number") = z01 a2.Recordset("Rank") = z02 a2.Recordset("Name") = z03 a2.Recordset("Department") = z04 a1.Recordset.MoveNext a2.Recordset.Update Loop a1.Recordset.MoveFirst a1.Refresh a2.Recordset.MoveFirst a2.Refresh Form1.Caption = "To add Test1 Table File from Exam02 Database File" End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

255

uuuGef

Access 2002 ½Sd Database File twGif;rS Table File twGif;½Sd Record tm;½Smjcif; atmufyg Form yHpk t H m; zefw;D wnfaqmufxm;&rnf/ yH(k 265)/

yHk(265) H iG f , , , , yHk(265)yg Form yHpk w rsm;jzifh zefw;D xm;Ny;D oufqikd &f m Properties rsm;wGijf yifqifjznfph u G Nf y;D aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ a1 - Adodc Properties twGuf (Name) Align BOFAction ConnectingString EOFAction Font RecordSource

-

a1 0 - vbAlignNone 0 - adDoMoveFirst provider=msdasql;dsn=exam02;uid=;pwd=; 0 - adDoMoveLast MS Sans Serif, Bold, 8 select [Identification Number], Rank, Name, Department from Test1 order by [Identification Number]


Contents Microsoft Visual Basic 6.0

256

uuuGef

DataGrid1 - DataGrid Properties twGuf (Name) DataGrid1 Align 0 - vbAlignNone AllowAddNew True AllowArrows True AllowDelete True AllowUpdate True Font MS Sans Serif, Bold, 8 DataSource a1 A1 - Adodc \ Record Position twGuf Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event StatusEnum, ByVal pRecordset As ADODB.Recordset) a1.Caption = "Record: " & CStr(a1.Recordset.AbsolutePosition) End Sub To Find Command Button twGuf Private Sub Command1_Click() Set DataGrid1.DataSource = a1 z1 = Text1 a1.Recordset.MoveFirst Do While a1.Recordset.EOF = False If a1.Recordset("Identification Number") = z1 Then Cls Print Print a1.Recordset("Identification Number"), a1.Recordset ("Rank"),a1.Recordset("Name"), a1.Recordset ("Department") Exit Do Else Cls Print Print "Not Fount" End If a1.Recordset.MoveNext Loop


Contents Microsoft Visual Basic 6.0

257

uuuGef

End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub txufyg Program udk Run yguatmufygtwdik ;f jrifawGU&rnf/ yH(k 266)/

yHk(266) ---------------0-0-0---------------


Contents

uuuGef

258

Microsoft Visual Basic 6.0

tcef;(10) Microsoft Visual 6.0 jzifh,cifoHk; Access zdkifwnfaqmufjcif; yxrOD;pGm Microsoft Visual 6.0 udkzGifhyg/ xdkYaemuf yHk(267)yg Form1 wGif Command Button udo k ;kH í atmufygtwdik ;f zefw;D &rnf/ Command Button rsm;wGif

oufqikd &f m y½d*k &rfrsm;a&;om;&rnf/ yHk(267)

Open Database Command Button twGuf Private Sub Command1_Click() Form1.Hide frmForm2.Show End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub Menu Bar ½Sd Add-Ins udka½G;yg/ tay:qHk; Pulldown Menu wpfcjk zpfonfh Visual Data Manager udka½G;yg/ yHk(268)/

yHk(268)

xdt k cg VisData Window Dialog Box wpfcak y:vmrnf/ yH(k 269)/


Contents Microsoft Visual Basic 6.0

259

uuuGef

yHk(269)

4if; Window xJrS Menu Bar wpfcjk zpfonfh File udak ½G;cs,&f efjzpfonf/ New... ud k x yf r H a ½G ; ygu Visual Basic 6.0 rS w nf a qmuf E d k i f o nf h atmuf y gzd k i f r sm; ay:vmayrnf/ yHk(270)/

yHk(270)


Contents Microsoft Visual Basic 6.0

uuuGef

260

yHk(270)yg yHkrS Microsoft Access 4udak ½G;cs,&f rnf/ xdt k cg Version 2.0 MDB... ESifh Version 7.0 MDB... wdaYk y:vmayrnf/ yH(k 271)/ yHk(271)

4if ; rS Version 7.0 ud k a ½G ; cs,f & rnf / xd k t cgzd k i f o pf w nf a qmuf & ef zdik t f rnftopf awmif;onfh Dialog Box ay:vmrnf/ yH(k 272)/

yHk(272)

yH(k 272)wGif zdik t f rnfay;Ny;D Save udak ½G;cs,yf g/ Oyrm/ Test01/ xdt k cg Database Window ay:vmrnf/ yHk(273)/

yHk(273)


Contents Microsoft Visual Basic 6.0

uuuGef

261

yHk(273)yg Database Windows Dialog Box wGifyg0ifaom Properties udka½G;NyD; Right Click ESyd yf g/ xdt k cg Short Cut Menu wpfcyk (kH 274)ygtwdik ;f ay:vm rnf/

yHk(274)

Short Cut Menu rS New Table udak ½G;cs,& f rnf/ xdt k cg Table Structure Dialog Box ay:vmrnf/ yHk(275)/

yHk(275)


Contents Microsoft Visual Basic 6.0

262

uuuGef

Table Name: List Box wGif Table File Name udr k rd pd w d Bf uKu d jf znfph u G yf g/ Oyrm/ Test01 [k owfrw S Nf y;D Add Field Command Button udak ½G;cs,&f rnf/ xdt k cg Add Field Dialog Box ay:vmrnf/ 4if;wGif Field Name, Field Type, Field Yk kd pdwBf uKu d jf znfph u G Nf y;D aemuf OK udk Click jyKvkyfyg/ yHk(276)/ Size wdu

yHk(276)

xdak emuf Add Field Dialog Box xyfraH y:vmNy;D rdrBd uKw d ifprD x H m;aom Field k wfrw S Nf y;D OK udak ½G;cs,&f rnf/ Field tm;vH;k Name, Field Type, Field Size rsm;udo owfrw S Nf y;D ygu Close Command Button udak ½G;cs,yf g/ yHk(277)/

yHk(277)


Contents Microsoft Visual Basic 6.0

263

uuuGef

xdt k cg yH(k 278)ygtwdik ;f jrifawGU&rnf/

yHk(278) Field Type wGiaf tmufyg vkyy f ikd cf iG t hf csurf sm;yg0ifonf (1) Boolean (2) Byte (3) Integer (4) Long (5) Currency (6) Single (7) Double (8) Date/Time (9) Text (10) Binary (11) Memo Field rsm;ay:wGifrlwnfNyD; Index jyKvy k v f ykd gu Add Index udak ½G;cs,yf g/ Add Index to Test01 Dialog Box ay:vmygu Name List Box wG i f trnfowfrw S yf g/ Index Fields tm;rdro d wfrw S v f o kd nfh Field Name udk Available Fields wGif Double Click jyKvkyfjcif;jzifhwnfaqmufEdkifayonf/ xdkYaemuf OK

udo k wfrw S &f rnf/ yH(k 279)


Contents Microsoft Visual Basic 6.0

264

uuuGef

yHk(279)

yHk(279) wGif OK udo k wfrw S v f u kd yf gu Table Structure Dialog Box ay: vmrnf/ yH(k 280)/

yHk(280)


Contents Microsoft Visual Basic 6.0

265

uuuGef

yH(k 280)wGif Close Command Button udak ½G;cs,yf gu rdrw d nfaqmufxm;aom Table File qHk;½IH;oGm;Edkifonf/ xdkYaMumifh Build the Table Command Button udka½G;cs,f &rnf/ xdktcg yHk(281)yg twdkif; Database Windows Dialog Box wpfcjk yefvnfay:vm ayrnf/

yHk(281)

xdaYk emuf Utility Menu rS Data Form Designer... udka½G;yg/ yHk(282)/

yHk(282)


Contents Microsoft Visual Basic 6.0

266

uuuGef

xdktcg yHk(283)ygtwdkif; Data Form Designer Dialog Box ay:vmrnf/

yHk(283)

Form Name [w/o Extension]: List Box wGir f rd o d wfrw S v f o kd nfh trnfukd jznfph u G yf g/ Oyrm - Form2 [kjznfph u G Nf y;D RecordSource: List Box wGif Dropdown k cg Pulldown Menu xJrS rdrzd efw;D xm; List Arrow udk Mouse jzifh Click jyKvyk yf g/ xdt onfh Table File tm;a½G;cs,yf gu yH(k 284)ygtwdik ;f jzpfay:vmrnf/

yHk(284)


Contents Microsoft Visual Basic 6.0

267

uuuGef

yHk(284)wGif Available Fields: xJrS rdrt d vd½k o dS nfh Field rsm;tm; Included f g/ yH(k 285) Fields: List Box xJoYkd > or >> jzifhydkYyg/ Oyrm - Fields tm;vH;k udak ½G;cs,y twdik ;f jrifawGU&rnf/

yHk(285)

xdaYk emuf Build the Form Command Button tm;a½G;cs,yf g/ qufvufí Close Command Button udak ½G;cs,& f rnf/ xdt k cg Data Entry jyKvkyf&ef Form wpfck&½Sdvmayrnf/ yHk(286)/

yHk(286)

yHk(286)yg Form yHpk t H m; yH(k 287)ygtwdik ;f odr;f qnf;&rnf/


Contents Microsoft Visual Basic 6.0

uuuGef

268

yHk(287)

Form2 wGiy f g0ifaom Toolbox Icon rsm;rSm udak vhvmygu Text Box,

Command Button,

Label,

Data wdkYyg0ifNyD; 4if;wdkY\ Properties

rsm;udk jyifqifjznfph u G Nf y;D aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm; a&;om;&rnfjzpfonf/ lblLabels(0) - Label Properties rSm (Name) lblLabels Alignment 0 - Left Justify AutoSize False BackStyle Opaque Caption LabourID: DataFormat General Font MS Sans Serif, Regular, 8 Index 0 WordWrap False lblLabels(1) - Label Properties rSm (Name) lblLabels Alignment 0 - Left Justify AutoSize False BackStyle Opaque


Contents Microsoft Visual Basic 6.0

269

Caption Name: DataFormat General Font MS Sans Serif, Regular, 8 Index 1 WordWrap False lblLabels(2) - Label Properties rSm (Name) lblLabels Alignment 0 - Left Justify AutoSize False BackStyle Opaque Caption Date of Birth: DataFormat General Font MS Sans Serif, Regular, 8 Index 2 WordWrap False lblLabels(3) - Label Properties rSm (Name) lblLabels Alignment 0 - Left Justify AutoSize False BackStyle Opaque Caption Salary: DataFormat General Font MS Sans Serif, Regular, 8 Index 3 WordWrap False txtFields(0) - Text Properties rSm (Name) txtFields Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField LabourID DataFormat General DataSource Data1

uuuGef


Contents Microsoft Visual Basic 6.0

270

Font MS Sans Serif, Regular, 8 Index 0 MultiLine False txtFields(1) - Text Properties rSm (Name) txtFields Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Name DataFormat General DataSource Data1 Font MS Sans Serif, Regular, 8 Index 1 MultiLine False txtFields(2) - Text Properties rSm (Name) txtFields Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Date of Birth DataFormat General DataSource Data1 Font MS Sans Serif, Regular, 8 Index 2 MultiLine False txtFields(3) - Text Properties rSm (Name) txtFields Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Salary DataFormat General DataSource Data1 Font MS Sans Serif, Regular, 8 Index - 3

uuuGef


Contents Microsoft Visual Basic 6.0

271

uuuGef

MultiLine - False Data1 - Data Properties rSm (Name) - Data1 Align - 2 - Align Bottom BOFAction - 0 - Move First DatabaseName-C:\Program Files\Microsoft Visual Studio\VB98\Test01.mdb EOFAction - 0 - Move Last ReadOnly - False RecordsetType - 1 - Dynaset RecordSource - Test01 cmdAdd - Command Button Properties rSm (Name) - cmdAdd Caption - &Add Font - MS Sans Serif, Regular, 8 cmdDelete - Command Button Properties rSm (Name) - cmdDelete Caption - &Delete Font - MS Sans Serif, Regular, 8 cmdRefresh - Command Button Properties rSm (Name) - cmdRefresh Caption - &Refresh Font - MS Sans Serif, Regular, 8 cmdUpdate - Command Button Properties rSm (Name) - cmdUpdate Caption - &Update Font - MS Sans Serif, Regular, 8 cmdClose - Command Button Properties rSm (Name) - cmdClose Caption - &Close Font - MS Sans Serif, Regular, 8


Contents Microsoft Visual Basic 6.0

272

uuuGef

Add Command Button twGuf Private Sub cmdAdd_Click() Data1.Recordset.AddNew End Sub Delete Command Button twGuf Private Sub cmdDelete_Click() 'this may produce an error if you delete the last 'record or the only record in the recordset Data1.Recordset.Delete Data1.Recordset.MoveNext End Sub Refresh Command Button twGuf Private Sub cmdRefresh_Click() 'this is really only needed for multi user apps Data1.Refresh End Sub Update Command Button twGuf Private Sub cmdUpdate_Click() Data1.UpdateRecord Data1.Recordset.Bookmark = Data1.Recordset.LastModified End Sub Close Command Button twGuf Private Sub cmdClose_Click() frmForm2.Hide Form1.Show End Sub Error twGuf Private Sub Data1_Error(DataErr As Integer, Response As Integer) 'This is where you would put error handling code 'If you want to ignore errors, comment out the next line 'If you want to trap them, add code here to handle them MsgBox "Data error event hit err:" & Error$(DataErr)


Contents Microsoft Visual Basic 6.0

273

uuuGef

Response = 0 'throw away the error End Sub Record Position twGuf Private Sub Data1_Reposition() Screen.MousePointer = vbDefault On Error Resume Next 'This will display the current record position 'for dynasets and snapshots Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1) 'for the table object you must set the index property when 'the recordset gets created and use the following line 'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1 End Sub Data1 Validate twGuf Private Sub Data1_Validate(Action As Integer, Save As Integer) 'This is where you put validation code 'This event gets called when the following actions occur Select Case Action Case vbDataActionMoveFirst Case vbDataActionMovePrevious Case vbDataActionMoveNext Case vbDataActionMoveLast Case vbDataActionAddNew Case vbDataActionUpdate Case vbDataActionDelete Case vbDataActionFind Case vbDataActionBookmark Case vbDataActionClose End Select Screen.MousePointer = vbHourglass End Sub

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


Contents Microsoft Visual Basic 6.0

uuuGef

274

,cifoHk; Access zdkifudk Data Report wnfaqmufí Report wnfaqmufjcif; yxrOD;pGm Microsoft Visual 6.0 udkzGifhyg/ xdkYaemuf yHk(288)yg Form1 wGif Command Button udo k ;kH í atmufygtwdik ;f zefw;D &rnf/

yHk(288)

xdaYk emuf Menu Bar ½Sd Project udka½G;yg/ xdkYaemuf Pulldown Menu xJrS Add Data Report udx k yfraH ½G;cs,&f rnf/ yH(k 289)/

yHk(289)


Contents Microsoft Visual Basic 6.0

uuuGef

275

yHk(290)ygtwdkif; Project1 - DataReport1 [DataReport] Form ay: vmayrnf/

yHk(290)

txufyg Report Form yHpk t H m;zefw;D vdu k o f nfEiS hf Project Explore wGif vnf; yH(k 291)ygtwdik ;f DataReport1(DataReport1) topfwpfcw k ;kd vmayrnf/

yHk(291)

txufyg Report Form yHpk t H m;trnfajymif;vJ&ayrnf/ Properties - Data S yf g/ yH(k 292)/ Report1 wGif Name 端 RDataReport1 [kajymif;vJowfrw


Contents Microsoft Visual Basic 6.0

uuuGef

276

yHk(292)

Project Explore wGif vnf; yH(k 293)ygtwdi k ;f RDataReport1(DataReport1)

[ktrnfajymif;oGm;ayrnf/

yHk(292)

tqdyk g RDataReport1(RDataReport1) File udo k rd ;f vdyk gu Menu Bar ½Sd File udak ½G;cs,y f g/ xdaYk emuf Save Project udx k yfraH ½G;cs,yf gu Save File As Dialog Box ay:vmrnf/ Save Command Button udka½G;cs,f&rnf/ yHk(293)/


Contents Microsoft Visual Basic 6.0

277

uuuGef

yHk(293)

xyfrHí Menu Bar jzpfaom Project rS More ActiveX Designers... udk a½G;cs,&f rnf/ xdt k cg Data Environment qdo k nfh Sub-Menu wpfcx k yfraH y:vmrnf/ 4if;udkxyfrHa½G;cs,fyg/ yHk(294)/

yHk(294)


Contents Microsoft Visual Basic 6.0

uuuGef

278

xd k t cg yH k ( 295)wG i f a zmf j yxm;aom Project1 - DataEnvironment1 k rnfajymif;&ef Proper[DataEnvironment] Dialog Box ay:vmayrnf/ 4if;udt ties udak ½G;í Properties - DataEnvironment wGif Name RDataEnvironment1 [kajymif;vJowfrw S &f rnf/ yH(k 296)

yHk(295)

yHk(296)

Project Explore wGif vnf; yH(k 297)ygtwdi k ;f RDataReport1(DataReport1)

[ktrnfajymif;oGm;ayrnf/


Contents Microsoft Visual Basic 6.0

279

uuuGef

yHk(297)

xdak emuf Project1 - RDataEnvironment [DataEnvironment] wGif Connection1 udka½G;í Right Click udkESdyfyg/ Short Cut Menu ay:vmygu yH(k 298)wGif azmfjyxm;onft h wdik ;f Properties... udk xyfraH ½G;cs,yf g/

yHk(298)


Contents Microsoft Visual Basic 6.0

280

uuuGef

xdt k cg Data Link Properties Dialog Box ay:vmrnf/ 4if;rS Provider Tab Command Button udak ½G;í Microsoft Jet 3.51 OLE DB Provider udak ½G;cs,f yg/ yHk(299)/

yHk(299)

xdaYk emuf Connection Tab Command Button udak ½G;cs,yf g/ yH(k 300)ygtwdik ;f 1. Select or enter a database name: List Box wGif Database File Name awmif; ygu rdru d , kd w f ikd f Database File Name ½du k x f nfjh cif;jzifv h nf;aumif;? udx k yfrH a½G;cs,jf cif;jzifv h nf;aumif; tvd½k adS om Database File Name udak ½G;cs,yf g/ yH(k 301)/


Contents Microsoft Visual Basic 6.0

uuuGef

281

yHk(300)

yHk(301)

Test Connection udak ½G;cs,y f gu rdrad ½G;cs,cf ahJ om Database File ESifh Path

vrf;aMumif;rSefuefygu yHk(302)ygtwdkif;azmfjyrnfjzpfonf/

yHk(302)


Contents Microsoft Visual Basic 6.0

282

uuuGef

xdek nf;wl Data Link Properties Dialog Box \ Tab Command Button rsm;jzpfMuaom Advanced yH(k 303) ESihf All yH(k 304)wdw Yk iG rf nfonft h csurf Qajymif;vJ&ef rvdb k J OK udak ½G;cs,&f efjzpfygonf/

yHk(303)

yHk(304)


Contents Microsoft Visual Basic 6.0

283

uuuGef

xdak emuf Project1 - RDataEnvironment [DataEnvironment] wGif Connection1 udka½G;í Right Click udkESdyfyg/ Short Cut Menu ay:vmygu yH(k 305)wGif azmfjyxm;onft h wdik ;f Add Command udk xyfrHa½G;cs,fyg/

yHk(305)

xdktcg yHk(306)ygtwdkif; jzpfay:vmrnf/

yHk(306)


Contents Microsoft Visual Basic 6.0

284

uuuGef

tqdyk g RDataEnvironment1(RDataEnvironment1) File udo k rd ;f vdyk gu Menu Bar ½Sd File udka½G;cs,fyg/ xdkYaemuf Save Project udx k yfraH ½G;cs,yf gu Save f rnf/ yH(k 307)/ File As Dialog Box ay:vmrnf/ Save Command Button udak ½G;cs,&

yHk(307)

Project Explore jzpfonfh Project - Project1 Dialog Box wGifvnf; RDataEnvironment1(RDataEnvironment1)tpm; RDataEnvironment1 (RDataEnvironment1.Dsr) tjzpfajymif;vJomG ;rnf/ yH(k 308)/

yHk(308)


Contents Microsoft Visual Basic 6.0

285

uuuGef

Project1 - RDataEnvironment [DataEnvironment] wGif Connection1 udak ½G;í Right Click udkESdyfyg/ Short Cut Menu ay:vmygu yH(k 309)wGiaf zmfjyxm; onft h wdik ;f Properties udk xyfraH ½G;cs,yf g/

yHk(309)

xdt k cg Command1 Properties Dialog Box wpfckay:vmrnf/ 4if;wGif General, Parameters, Relation, Grouping, Aggregates, Advanced qdo k nfh Tab Command Button (6)ckay:vmrnf/ 4if; Tab Command rsm;xJrS General Tab Command udka½G;yg/ yHk(310)/


Contents Microsoft Visual Basic 6.0

286

uuuGef

yHk(310)

Source of Data acgif;pOfatmufwi G ½f adS om Database Object: List Box Dropdown Arrow udka½G;í Table udkajymif;yg/ Object Name: List Box wGif Dropdown Arrow tultnDjzifh rdrz d efw;D xm;cJah om Test01 udak ½G;cs,&f rnf/ yH(k 311)/

yHk(311)

usef Tab Command Button rsm;tm;jyKjyifp&mrvdak wmhonft h wGuf Apply f g/ xdt k cg Project1 - DataEnvironment1 [DataEnvironment] -> OK udak ½G;cs,y \ udak ½G;ygu yH(k 312)wGif azmfjyxm;ouJo h Ykd Field Dialog Box ½Sd Name rsm;azmfjyaeayrnf/


Contents Microsoft Visual Basic 6.0

287

uuuGef

yHk(312)

xdaYk emuf Project1 - RDataReport1 [DataReport] udjk yefvnfqw GJ if&rnf/ yHk(313)/

yHk(313)

Page Header (Section2) Activate jzpfaeaomtcg Right Click udkESdyfyg/ Short Cut Sub-Menu wpfcak y:vmrnf/ 4if;rS Insert Control udak ½G;Ny;D Label udx k yfrH

a½G;cs,f&rnf/ yHk(314)/


Contents Microsoft Visual Basic 6.0

288

uuuGef

yHk(314) xdt k cg yH(k 315)ygtwdik ;f jzpfay:vmrnf/

yHk(315)


Contents Microsoft Visual Basic 6.0

289

uuuGef

xdek nf;twdik ;f Label (4)ckzefwD;NyD; Labour ID, Name, Date of Birth, Salh rnfowfrw S yf g/ yH(k 316)? yH(k 317)/ ary ponfjzift

yHk(316)

yHk(317) Datail (Section1) Activate jzpfaeaomtcg Right Click udkESdyfyg/ Short k yfrH Cut Sub-Menu wpfcak y:vmrnf/ 4if;rS Insert Control udka½G;NyD; TextBox udx

a½G;cs,f&rnf/ yHk(318)/


Contents Microsoft Visual Basic 6.0

290

yHk(318) xdt k cg yH(k 319)ygtwdik ;f jzpfay:vmrnf/

uuuGef


Contents Microsoft Visual Basic 6.0

291

uuuGef

yHk(319) xdek nf;twdik ;f TextBox (4)ckzefwD;&rnf/ yHk(320)/

yHk(320) Project1 - RDataReport1 [DataReport] Activate jzpfaeaomtcg Smart \tultnDjzifh yH(k 321)wGiaf zmfjyxm;onft h wdik ;f Properties Icon jzpfaom RDataReport1 ü DataSource wGif List Dropdown Arrow jzifh RData Environf rnf/ DataMember wGif List Dropdown Arrow jzifh Comment1 udak ½G;cs,& k yfraH ½G;cs,&f rnf/ mand1 udx


Contents Microsoft Visual Basic 6.0

uuuGef

292

yHk(321)

Detail (Section1) Activate ap&efjyKvy k í f yxrOD;qH;k jrifawGUae&onfh Text \tultnDjzifh yH(k 322)wGiaf zmfjyxm;onfh Box udka½G;yg/ Smart Icon jzpfaom twdik ;f Properties - Text1 ü DataMember \ List Dropdown Arrow jzifh Comk nf;aumif;? DataField \ List Dropdown Arrow jzifh LabourID mand1 udv udv k nf;aumif;a½G;cs,&f rnf/ xdek nf;wlusef Text Box toD;oD;udv k nf; DataMember, Yk q kd aD vsmaf tmifjyKvyk &f rnf/ yH(k 323)/ DataField wdu


Contents Microsoft Visual Basic 6.0

293

yHk(322)

yHk(323)

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

294

yHk(324)

txufyg yHk(324)udkjyefoGm;NyD; oufqdkif&m Command Button rsm;wGif atmufazmfjyyg yH(k 325)yg twdik ;f Coding rsm;udak &;&rnf/

yHk(325)

rSwfcsuf/ / DataReport toH;k jyKygu DataEnvironment udo k ;kH udo k ;kH &rnf jzpfonf/ DataEnvironment wGif Database File rwlnyD gu Connection1, Conk Nf y;D Database File wlnND y;D Table File (rwlnv D Qi)f nection2, ... [lí cJjG cm;toH;k jyK Edi rsm;jym;aeygu Command1, Command2, ... zefw;D ítoH;k jyKEikd yf gonf/ ----------0-0-0----------


Contents Microsoft Visual Basic 6.0

uuuGef

295

,cifoHk; Access zdkifudk Form wnfaqmufí"gwfyHkrsm;Munfhjcif; yxrOD;pGm Microsoft Visual 6.0 udkzGifhyg/ xdkYaemuf yHk(326)yg Form1 wGif Command Button rsm;udo k ;kH í atmufygtwdik ;f zefw;D Ny;D vdt k yfaomy½d*k &rfrsm;a&;om; &rnf/

yHk(326)

Data Entry Command Button twGuf Private Sub Command1_Click() frmForm2.Show End Sub Exit Command Button twGuf Private Sub Command2_Click() Unload Me End End Sub

xdaYk emuf yH(k 327)yg frmForm2 wGiv f t kd yfaom Label, TextBox, OLE, Data, k ;kH í atmufygtwdik ;f zefw;D &rnf/ vdt k yfaom ProperCommand Button rsm;udo k nf;jyifqif&rnf/ ties rsm;udv


Contents Microsoft Visual Basic 6.0

296

uuuGef

yHk(327)

OLE

Data

lblLabels(0) - lblLabels Properties twGuf (Name) lblLabels Alignment 0 - Left Justify AutoSize False BackStyle 1 - Opaque Caption LabourID: Font MS Sans Serif, Regular, 8 Index 0 WordWrap False lblLabels(1) - lblLabels Properties twGuf (Name) lblLabels Alignment 0 - Left Justify AutoSize False BackStyle 1 - Opaque Caption Name: Font MS Sans Serif, Regular, 8 Index 1 WordWrap False


Contents Microsoft Visual Basic 6.0

297

lblLabels(2) - lblLabels Properties twGuf (Name) lblLabels Alignment 0 - Left Justify AutoSize False BackStyle 1 - Opaque Caption Date of Birth: Font MS Sans Serif, Regular, 8 Index 2 WordWrap False lblLabels(3) - lblLabels Properties twGuf (Name) lblLabels Alignment 0 - Left Justify AutoSize False BackStyle 1 - Opaque Caption Salary: Font MS Sans Serif, Regular, 8 Index 1 WordWrap False lblLabels(4) - lblLabels Properties twGuf (Name) lblLabels Alignment 0 - Left Justify AutoSize False BackStyle 1 - Opaque Caption Photos: Font MS Sans Serif, Regular, 8 Index 1 WordWrap False txtFields(0) - txtFields Properties twGuf (Name) txtFields Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField LabourID DataFormat General DataSource Data1

uuuGef


Contents Microsoft Visual Basic 6.0

298

Font MS Sans Serif, Regular, 8 Index 0 MultiLine False txtFields(1) - txtFields Properties twGuf (Name) txtFields Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Name DataFormat General DataSource Data1 Font MS Sans Serif, Regular, 8 Index 1 MultiLine False txtFields(2) - txtFields Properties twGuf (Name) txtFields Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Date of Birth DataFormat General DataSource Data1 Font MS Sans Serif, Regular, 8 Index 2 MultiLine False txtFields(3) - txtFields Properties twGuf (Name) txtFields Alignment 0 - Left Justify BorderStyle 1 - Fixed Single DataField Salary DataFormat General Font MS Sans Serif, Regular, 8 Index 3 MultiLine False

uuuGef


Contents Microsoft Visual Basic 6.0

299

oleFields(0) - oleFields Properties twGuf (Name) oleFields AutoActivate 2 - DoubleClick BackStyle 1 - Opaque BorderStyle 1 - Fixed Single DataField Photos DataSource Data1 Font MS Sans Serif, Regular, 8 Index 0 OLEDropAllowed False OLETypeAllowed 2 - Either SizeMode Stretch cmdAdd - Command Button Properties rSm (Name) - cmdAdd Caption - &Add Font - MS Sans Serif, Regular, 8 cmdDelete - Command Button Properties rSm (Name) - cmdDelete Caption - &Delete Font - MS Sans Serif, Regular, 8 cmdRefresh - Command Button Properties rSm (Name) - cmdRefresh Caption - &Refresh Font - MS Sans Serif, Regular, 8 cmdUpdate - Command Button Properties rSm (Name) - cmdUpdate Caption - &Update Font - MS Sans Serif, Regular, 8 cmdClose - Command Button Properties rSm (Name) - cmdClose Caption - &Close Font - MS Sans Serif, Regular, 8

uuuGef


Contents Microsoft Visual Basic 6.0

300

uuuGef

Data1 - Data Properties rSm (Name) - Data1 Align - 0 - None BOFAction - 0 - Move First Connect - Access DatabaseName-C:\Program Files\Microsoft Visual Studio\VB98\Test01.mdb EOFAction - 0 - Move Last Font - MS Sans Serif, Regular, 8 ReadOnly - False RecordsetType - 1 - Dynaset RecordSource - Test01 Add Command Button twGuf Private Sub cmdAdd_Click() Data1.Recordset.AddNew End Sub Delete Command Button twGuf Private Sub cmdDelete_Click() 'this may produce an error if you delete the last 'record or the only record in the recordset Data1.Recordset.Delete Data1.Recordset.MoveNext End Sub Refresh Command Button twGuf Private Sub cmdRefresh_Click() 'this is really only needed for multi user apps Data1.Refresh End Sub Update Command Button twGuf Private Sub cmdUpdate_Click() Data1.UpdateRecord Data1.Recordset.Bookmark = Data1.Recordset.LastModified End Sub


Contents Microsoft Visual Basic 6.0

301

uuuGef

Close Command Button twGuf Private Sub cmdClose_Click() frmForm2.Hide Form1.Show End Sub Error twGuf Private Sub Data1_Error(DataErr As Integer, Response As Integer) 'This is where you would put error handling code 'If you want to ignore errors, comment out the next line 'If you want to trap them, add code here to handle them MsgBox "Data error event hit err:" & Error$(DataErr) Response = 0 'throw away the error End Sub Record Position twGuf Private Sub Data1_Reposition() Screen.MousePointer = vbDefault On Error Resume Next 'This will display the current record position 'for dynasets and snapshots Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1) 'for the table object you must set the index property when 'the recordset gets created and use the following line 'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1 End Sub Data1 Validate twGuf Private Sub Data1_Validate(Action As Integer, Save As Integer) 'This is where you put validation code 'This event gets called when the following actions occur Select Case Action Case vbDataActionMoveFirst Case vbDataActionMovePrevious


Contents Microsoft Visual Basic 6.0

uuuGef

302

Case vbDataActionMoveNext Case vbDataActionMoveLast Case vbDataActionAddNew Case vbDataActionUpdate Case vbDataActionDelete Case vbDataActionFind Case vbDataActionBookmark Case vbDataActionClose End Select 'Screen.MousePointer = vbHourglass End Sub OLEField Double Click twGuf Private Sub oleFields_DblClick(Index As Integer) 'this is the way to get data into an empty ole control 'and have it saved back to the table oleFields(Index).InsertObjDlg End Sub

----------0-0-0---------Toolbox xJwGif Crystal Report Smart Icon xnfhjcif; Toolbox wGif Right Click ESdyfyg/ xdktcg Short Cut Menu ay:vmygu Components... udx k yfraH ½G;cs,&f rnf/ yH(k 328)/

yHk(328)


Contents Microsoft Visual Basic 6.0

uuuGef

303

Components Dialog Box ay:vmygu Crystal Report Control 4.6 udak ½G; NyD; Check vky&f rnf/ xdaYk emuf Apply, OK udx k yfraH ½G;cs,&f rnf/ yH(k 329)/

yHk(329)

Crystal Report Control 4.6 udak ½G;Edi k jf cif;onf C:\WINDOWS\SYSTEM\ CRYSTL32.OCX zdkif½Sdjcif;aMumifhjzpfonf/ xdktcg Toolbox ü Crystal Report dS mrnf/ yH(k 330)/ Icon a&muf½v

yHk(330)

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


Contents Microsoft Visual Basic 6.0

uuuGef

304

Crystal Report wnfaqmufjcif; ( ,cif Access File ) yxrOD;pGm Visual Basic 6.0 udzk iG yhf g/ xdaYk emuf Menu Bar rS Add-Ins udk a½G;í Pulldown Menu wpfcjk zpfaom Report Designer... udak ½G;cs,&f rnf/ yH(k 331)

yHk(331)

yH(k 332)ygtwdik ;f jzpfay:vmygu Cancel Command Button udak ½G;cs,yf g/

yHk(332)


Contents Microsoft Visual Basic 6.0

uuuGef

305

Crystal Reports Registration Express Dialog Box aysmufomG ;vdrr hf nf/ xdt k cg Report wnfaqmuf&eftqifoifjh zpfaeayvdrrhf nf/ Crystal Reports Pro Dialog Box wGif New... udk yH(k 333)a½G;ygu yH(k 334)yg twdik ;f Create New Report Dialog Box jzpfay:vmrnf/

yHk(333)

yHk(334)

Create New Report Dialog Box xJrS Standard udx k yfraH ½G;cs,yf gu yH(k 335)

ygtwdkif;jzpfay:vmayrnf/


Contents Microsoft Visual Basic 6.0

306

uuuGef

yHk(335)

Create Report Expert Dialog Box wGif Data File Command Button udk

xyfrHa½G;cs,f&rnf/ yHk(336)

yHk(336)

Choose Database File Dialog Box xyfraH y:vmNy;D rdrt d oH;k jyKvo kd nfh Dak yfraH ½G;cs,&f ef List Files of Type:List Box udk Access Files (or) tabase File udx d vd½k o dS nfh Drives:, Directories: wdt Yk m; ajymif;vJí User Default [kajymif;yg/ rdrt tvd½k o dS nfh Microsoft Database File udak ½G;cs,Nf y;D Add Command Button udk

a½G;cs,f&rnf/ yHk(337)


Contents Microsoft Visual Basic 6.0

307

uuuGef

yHk(337) Choose Database File Dialog Box \trSm;jcpf Close Button udak ½G;jcif;jzifh aomfvnf;aumif;? Done Command Button udak ½G;jcif;jzifah omfvnf;aumif; xyfrH aqmif½u G &f rnf/ xdt k cg Choose Database File Dialog Box aysmufomG ;rnf/ yH(k 338)


Contents Microsoft Visual Basic 6.0

308

uuuGef

yHk(338)

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)/

yHk(339)

Database Fields: acgif;pOfatmuf½dS Database Fields: rsm;xJrS rdrt d vd½k adS om Field rsm;tm; Report Fields: acgif;pOfatmufoy Ykd &Ykd rnf/ Field wpfcck si;f a½G;vdyk gu Command Button jzifha½G;cs,fNyD; Field tm;vH;k a½G;vdy k gu Command Button jzifha½G;cs,f&rnf/ yHk(340)/


Contents Microsoft Visual Basic 6.0

309

uuuGef

yHk(340) xdaYk emuf Next>> Command Button udka½G;cs,fyg/ yHk(341)/

yHk(341) xdt k cg Tab Command wpfcjk zpfaom 3: Sort odaYk &muf½o dS mG ;rnf/ txufyg yH(k 341)wGif rdrt d yk pf zk UGJ vdo k nfh Field tm; tkypf zk UGJ Edik o f nf/ tkypf zk UGJ &ef rvdt k yfygu Preview Report udx k yfraH ½G;yg/ yH(k 342)/


Contents Microsoft Visual Basic 6.0

310

uuuGef

yHk(342) txufygyHw k iG af zmfjyxm;aom Design tm;a½G;cs,yf gu yH(k 343)twdik ;f jyKjyif rGr;f rHEikd &f ef tajctaeay;vdrrhf nf/


Contents Microsoft Visual Basic 6.0

311

uuuGef

yHk(343)

xdaYk emuf Menu Bar ½Sd Insert udka½G;cs,fyg/ Pulldown Menu wpfcjk zpfaom Text Field udka½G;cs,fyg/ yHk(344)/


Contents Microsoft Visual Basic 6.0

uuuGef

312

yHk(344)

xdt k cg Edit Text Field Dialog Box ay:vmNy;D acgif;pOftm;rdrpd w d Bf uKu d f zefw;D í&ayonf/ yH(k 345)/ xdaYk emuf Accept Command Button udak ½G;cs,yf g/

yHk(345)

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/ xdaYk emuf Change f rnf/ yH(k 346)/ Format... udak ½G;cs,&


Contents Microsoft Visual Basic 6.0

uuuGef

313

yHk(346)

xdt k cg Format String Dialog Box ay:vmrnf/ yHk(347) 4if;rS Alignment wGif Centered udk a½G;Ny;D OK udx k yfraH ½G;cs,yf gu acgif;pOfpmom; tv,fño §d mG ;ayrnf/ yHk(348)

yHk(347)


Contents Microsoft Visual Basic 6.0

uuuGef

314

yHk(348)

txufyg Report File tm;odrf;vdkygu Menu Bar ½Sd File udka½G;cs,fyg/ xdaYk emuf Pulldown Menu xJrS Save udak ½G;cs,yf g/ yH(k 349)

yHk(349)


Contents Microsoft Visual Basic 6.0

315

uuuGef

xdt k cg File Save As Dialog Box ay:vmrnf/ rdrpd w d Bf uKu d o f rd ;f vdo k nfh zdik t f rnfuakd y;Ny;D OK udk Click vkyf&rnf/ yHk(350)/

yHk(350)

Crystal Reports Title Bar onfvnf; [Untitled Report #1] r[kwaf wmhbJ [c:\program files\microsoft visual studio\vb98\std09.rpt] [lĂ­ajymif;vJomG ;ay

rnf/ yHk(351)/

yHk(351) ----------0-0-0----------


Contents Microsoft Visual Basic 6.0

uuuGef

316

Crystal Report wnfaqmufjcif; ( Access File 2000 txuf ) yxrOD;pGm Visual Basic 6.0 udzk iG yhf g/ xdaYk emuf Menu Bar rS Add-Ins udk a½G;í Pulldown Menu wpfcjk zpfaom Report Designer... udak ½G;cs,&f rnf/ Create h ifjh yKvyk Nf y;D SQL/ODBC ComReport Expert Dialog Box a&mufonftxdtqifq mand Button udka½G;cs,f&rnf/ yHk(352)

yHk(352)

xdt k cg Log On Server Dialog Box topfwpfcak y:vmrnf/ yH(k 353)

yHk(353)

yHk(353)yg Dialog Box rS ODBC:exam01 udak ½G;cs,yf g/ xdaYk emuf OK udk Click vkyy f g/ xdt k cg Choose SQL Table Dialog Box ay:vmrnf/ yHk(354)/


Contents Microsoft Visual Basic 6.0

317

uuuGef

yHk(354)

Choose SQL Table Dialog Box xJrS SQL Tables: acgif;pOfatmuf½Sd List d w d Bf uKu d f Table File udadk ½G;cs,&f rnf/ Oyrm - exam01 udak ½G;cs,yf g/ Box wGif rdrp Add Command Button udx k yfraH ½G;cs,yf g/ Close Button udak ½G;cs,yf gu yH(k 355)

ygtwdik ;f jzpfvmrnf/

yHk(355)

yHk(355)wGif Next >> Command Button udx k yfraH ½G;cs,&f rnf/ yH(k 356)yg twdik ;f azmfjyrnf/


Contents Microsoft Visual Basic 6.0

318

uuuGef

yHk(356)

txufygyHk(356)wGif Database Fields: ü Field rsm;pdwfBuKduf(odkYr[kwf) tm;vH;k udk a½G;cs,Ef ikd af yonf/ Oyrm - Fields rsm;tm;vH;k a½G;cs,&f ef All ->> Command Button udka½G;cs,f&rnf/ yHk(357)

yHk(357)

xdaYk emuf Next udx k yfraH ½G;cs,yf g/ yH(k 358)ygtwdik ;f azmfjyrnf/


Contents Microsoft Visual Basic 6.0

319

uuuGef

yHk(358)

txufygyH(k 358)wGif Group Fields aqmif½u G v f ykd gu vkyyf ikd cf iG ahf y;xm;Ny;D raqmif½u G v f ykd gu Preview Report Command Button udak ½G;cs,&f rnf/ xdt k cg yH(k 359)twdik ;f jzpfay:vmrnf/

yHk(359)


Contents Microsoft Visual Basic 6.0

320

uuuGef

Design Tab Command Button udak ½G;cs,y f gu yH(k 360)ygtwdik ;f jzpfay:vm

rnf/

yHk(360) txufygyHk(360)wGifazmfjyxm;aom Crystal Report File tm;odrf;vdkygu Menu Bar wGi½ f o dS nfh File udak ½G;cs,yf g/ Pulldown Menu wpfcjk zpfaom Save udk a½G;cs,yf g/ xdt k cg File Save As Dialog Box ay:vmrnf/ rdrpd w d Bf uKu d v f rf;aMumif; wGif Report File Name udjk znfph u G Nf y;D OK Command Button udak ½G;cs,&f rnf/ yHk(361)/


Contents Microsoft Visual Basic 6.0

321

uuuGef

yHk(361)

----------0-0-0---------Crystal Report jzifh Graphic File ½dkufxkwfjcif; yxrOD;pGm Visual Basic 6.0 wGif "gwfyHkrsm;yg0ifaom Access File udk wnfaqmufxm;&rnf/ "gwfyrkH sm;udk Windows BitMap File Format jzifo h m Data k &f rnf/ Access 2000 xufapmaom ,cif Access File rsm;twGurf l Entry jyKvy Crystal Report \vkyfydkifcGifhjzpfaom Create Report Expert Dialog Box ay:vm atmifzefw;D í Data File Command Button udak ½G;&rnf/ Access 2000 ESihf txuf Access File rsm;twGur f l Crystal Report \vkyfydkifcGifhjzpfaom Create Report Expert Dialog Box ay:vmatmifzefw;D í SQL/ODBC File Command Button udk a½G;&rnf/

yHk(362)


Contents Microsoft Visual Basic 6.0

322

uuuGef

xdt k cg Log On Server Dialog Box ay:vmrnf/ Server Type: acgif;pOf atmufwiG f rdrad ½G;cs,rf nfh Database File tm;½SmazG&rnf/ Oyrm - ODBC - Photo01 udak ½G;cs,yf g/ xdaYk emuf OK udk Click vkyf&rnf/ yHk(363)/

yHk(363)

Choose SQL Table Dialog Box ay:vmygu rdrdwnfaqmufxm;aom Database File xJwi G yf g0ifonfh Table File udak ½G;cs,Nf y;D Add Command Button

udk xyfraH ½G;cs,&f rnf/ yH(k 364)/

yHk(364)

Create Report Expert Dialog Box ay:vmNy;D Table File jzpfonfh Photo01 File ay:vmrnf/ yHk(365)/


Contents Microsoft Visual Basic 6.0

323

uuuGef

yHk(365)

yHk(365)wGif Next >> Command Button udx k yfraH ½G;cs,&f rnf/ yH(k 366)yg twdik ;f azmfjyrnf/

yHk(366)

txufygyHk(366)wGif Database Fields: ü Field rsm;pdwfBuKduf(odkYr[kwf) tm;vH;k udk a½G;cs,Ef ikd af yonf/ Oyrm - Fields rsm;tm;vH;k a½G;cs,&f ef All ->> Command Button udka½G;cs,f&rnf/ yHk(367)


Contents Microsoft Visual Basic 6.0

324

uuuGef

yHk(367)

xdaYk emuf Next udx k yfraH ½G;cs,yf g/ yH(k 368)ygtwdik ;f azmfjyrnf/

yHk(368)

txufygyH(k 368)wGif Group Fields aqmif½u G v f ykd gu vkyyf ikd cf iG ahf y;xm;Ny;D raqmif½u G v f ykd gu Preview Report Command Button udak ½G;cs,&f rnf/ xdt k cg yH(k 369)twdik ;f jzpfay:vmrnf/


Contents Microsoft Visual Basic 6.0

325

uuuGef

yHk(369)

Design Tab Command Button udak ½G;cs,y f gu yH(k 370)ygtwdik ;f jzpfay:vm

rnf/


Contents Microsoft Visual Basic 6.0

326

uuuGef

yHk(370)

Design View wGif Band (5)ckyg½Sr d nfjzpfonf/ Title, Page header, Details, Page footer, Summary wdjYk zpfMuonf/ Title onf acgif;pOfBu;D twGujf zpfNy;D ? Page header onf pm½Guw f ikd ;f wGiyf g½Srd nfh tkypf ak cgif;pOfrsm;? &ufp?GJ pmrsuEf mS eHygwfrsm; jzpfEikd o f nf/ Details onf Record rsm;azmfjy&eftwGuf Template rsm;jzpfayonf/ Page footer onfpm½Gut f oD;oD;\atmufq;kH wGiyf g0if&rnfh &ufp?GJ pmrsuEf mS eHygwfrsm; jzpfEikd yf gonf/ Details ESifh Page footer udk "gwfyrkH sm;xnfo h iG ;f &efoifw h ifrh QwpGmjcm; &rnf/ xdaYk emuf Menu Bar ½Sd Insert udka½G;yg/ Pulldown Menu jzpfaom Datak yfraH ½G;cs,&f rnf/ yH(k 371) base Field udx


Contents Microsoft Visual Basic 6.0

uuuGef

327

yHk(371)

xdt k cg Insert Database Field Dialog Box rS Field wpfcjk zpfaom photos udka½G;NyD; Insert Command Button udak ½G;cs,&f rnf/ yH(k 372)

yHk(372)


Contents Microsoft Visual Basic 6.0

328

uuuGef

xdt k cg yH(k 373)ygtwdik ;f "gwfy½kH &dS rnft h uGuu f ckd sed q f í tpm;xd;k twnfjyKNy;D aomtcg Insert -> Text Field jzifh vdt k yfrnfph mom;rsm;a&;om;yg/ yH(k 374)/

yHk(373)

yHk(374)

tqdyk g Crystal Report File tm; File -> Save udak ½G;Ny;D Report File Name ay;&efjzpfonf/ ----------0-0-0----------


Contents Microsoft Visual Basic 6.0

uuuGef

329

Access zdkifudk Crystal Report wnfaqmufí Print ½dkufxkwfjcif; yHk(375)yg Form1 wGif Command Button rsm;udo k ;kH í atmufygtwdik ;f zefw;D

wnfaqmufxm;&rnf/ /

yHk(375)

Crystal Report Private Sub Command1_Click() CrystalReport1.PrintReport End Sub Private Sub Command2_Click() Unload Me End End Sub

Microsoft Visual Basic 6.0 wGif Menu Bar wpfcjk zpfaom Add-in udak ½G;cs,f yg/ xdaYk emuf Pulldown Menu xJrS Report Designer... jzifh *.rpt File wpfzikd u f kd wnfaqmufxm;&rnf/ Oyrm - c:\program files\microsoft visual studio\vb98\ k nfaqmufxm;&rnf/ yH(k 376)/ exam01.rpt udw


Contents Microsoft Visual Basic 6.0

uuuGef

330

yHk(376) Crystal Report \ Properties wGif

(Name) BoundReportFooter CopiesToPrinter Destination DetailCopies DiscardSaveData Left MarginBottom MarginLeft MarginRight MarginTop PrinterCollation PrinterCopies PrinterStopPage PrintFileType

-

CrystallReport1 False 1 0 - crptToWindow 1 False 4200 0 0 0 0 2 - crptDefault 1 0 0 - crptRecord


Contents Microsoft Visual Basic 6.0 PrintFileUserRptDateFmt PrintFileUserRptNumberFmt ReportFileName

uuuGef

331 -

False False C:\Program Files\Microsoft Visual Studio\VB98\exam01.rpt ReportSource 0 - crptReport Top 960 WindowBorderStyle 2 - crptSizable WindowControlBox True WindowControls True WindowHeight 300 WindowLeft 100 WindowMaxButton True WindowMinButton True WindowState 0 - crptNormal WindowTop 100 WindowWidth 490 ---------------0-0-0--------------Database File wpfcktwGif;½Sd Table zdkifESpfckudktoHk;jyKíuHprf;rJEIdufjcif; 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)/

yHk(377)

xdt k cg VisData Dialog Box ay:vmvdrrhf nf/ 4if;rS Menu Bar jzpfaom File udak ½G;cs,yf g/ xdaYk emuf New udx k yfraH ½G;cs,&f rnf/ yH(k 378)/


Contents Microsoft Visual Basic 6.0

332

uuuGef

yHk(378)

yHk(378)ygtwdkif; New... udak ½G;cs,yf gu xyfrí H Sub-Menu wpfcak y:vmrnf/ 4if;rS rdrzd efw;D wnfaqmufrnfh Microsoft Access udak ½G;cs,yf g/ xdt k cg xyfrí H Sub-Menu wpfcak y:vmayrnf/ 4if; Sub-Menu rS Version 7.0 MDB... udak ½G;cs,f &rnf/ yH(k 379)/ yH(k 380)ygtwdik ;f ay:vmrnf/

yHk(379)


Contents Microsoft Visual Basic 6.0

333

uuuGef

yHk(380)

yHk(380)wGif Select Microsoft Access Database to Create Dialog Box ay:vmygu rdrw d nfaqmuftrnfay;vdo k nfh Database File trnfujkd znfph u G í f Save h u G Nf y;D Save ComCommand Button udka½G;cs,f&ayrnf/ Oyrm - Lucky [kjznfp mand Button udka½G;yg/ VisData Dialog Box wGif VisData:C:\Program\Lucky Draw\Lucky.mdb [k Title Bar üay:vmayrnf/ xdaYk emuf Database Window k yfraH y:vmrnf/ yH(k 381)/ Dialog Box wpfcx

yHk(381)


Contents Microsoft Visual Basic 6.0

uuuGef

334

Database Windows Dialog Box wGif Properties udak ½G;cs,y f g/ xdaYk emuf Right Click ESy d yf gu Sub-Menu wpfcak y:vmrnf/ xdk Sub-Menu xJrS New Table

udak ½G;cs,yf g/ yH(k 382)/

yHk(382)

xdt k cg Table Structure Dialog Box ay:vmrnf/ Table Name acgif;pOf ab; List Box ü rdrpd w d Bf uKu d f Table File trnfujkd znfph u G í f Add Field Command Button udka½G;cs,f&rnf/ yHk(383)/

yHk(383)


Contents Microsoft Visual Basic 6.0

335

uuuGef

Add Field Dialog Box ay:vmvdrr hf nf/ xdt k cg rdrt d vd½k o dS nfh Field Name, Yk o kd wfrw S &f rnf/ yH(k 384)? yH(k 385)/ Field Type, Field Size wdu

yHk(384)

yHk(385)

Field Name wpfcc k si;f oGi;f Ny;D ygu OK Command Button udak ½G;cs,&f rnf/ Field Name xyfrr H oGi;f vdak wmhygu Close Command Button udak ½G;cs,yf g/ xdt k cg

yHk(386)ygtwdkif;jzpfay:vmrnf/


Contents Microsoft Visual Basic 6.0

336

uuuGef

yHk(386) Index Field owfrw S v f ykd gu Add Index Command Button udak ½G;cs,&f rnf/ xdt k cg Add Index to Luck01 Dialog Box ay:vmygu Name List Box, InYk m; rdrpd w d Bf uKu d o f wfrw S Nf y;D OK Command Button udk dexed Fields List Box wdt a½G;cs,yf g/ xyfrí H Close Command Button udk a½G;cs,f&rnf? yHk(387)/

yHk(387)


Contents Microsoft Visual Basic 6.0

337

uuuGef

xdt k cg rlv Table Structure Dialog Box odjYk yefvnfa&muf½o dS mG ;rnf/ yH(k 388)/

yHk(388) txufyg Table Structure udkodrf;vdkygu Build the Table Command f rnf/ rlv Database Window Dialog Box odjYk yefvnfa&muf½dS Button udak ½G;cs,& oGm;ayrnf/ Close Command Button udak ½G;cs,yf gu tqdyk g Luck01 Table File udo k rd ;f rnfr[kwyf g/ yH(k 389)/


Contents Microsoft Visual Basic 6.0

338

uuuGef

yHk(389)

C:\Program Files\LuckDraw\Lucky.mdb udw k nfaqmufNy;D Luck01 Table d nfaqmufcNhJ y;D jzpfonf/ ,cktcg 4if; Database File xJwiG yf if Luck02 File ukw k yfrw H nfaqmuf&rnf/ Luck01 ESihf Luck02 Table File rsm;rSm waoG Table File udx rwdr;f wlnMD uojzifh Luck02 Table File tm; Luck01 Table File uJo h yYkd if tptqH;k

jyefwnfaqmufyguvnf;&onf/ jzwfvrf;enf;jzifhwnfaqmufvdkygu yHk(389)wGif jrifawGUae&aom Database Window Dialog Box rS Luck01 udka½G;yg/ xdkYaemuf Right Click ESy d yf g/ xdt k cg Short Cut Menu wpfcak y:vmrnf/ yH(k 390)/

yHk(390)


Contents Microsoft Visual Basic 6.0

339

uuuGef

Short Cut Menu xJrS Copy Structure... udx k yfraH ½G;cs,yf g/ xdt k cg yH(k 391)yg Copy Structure Dialog Box ay:vmrnf/

yHk(391)

4if; Dialog Box rS Target Connect String: acgif;pOfatmuf Text Box ü Lucky [kjznfp h u G Nf y;D Table: acgif;pOfatmuf Text Box ü Luck01 udak ½G;cs,&f rnf jzpfNyD; Copy Data Check Box udk Check jyK vky&f efjzpfonf/ xdaYk emuf OK Command Button udka½G;cs,fyg/ yHk(392)/

yHk(392)

xdt k cg VisData Dialog Box ay:vmrnf/ Enter New Table Name acgif;pOf atmuf Text Box ü rdrw d nfaqmufvo kd nfh Table Name udjk znfph u G &f rnf/ Oyrm Luck02 [kjznfp h u G Nf y;D OK Command Button udak ½G;cs,&f rnf/ yH(k 394)/


Contents Microsoft Visual Basic 6.0

uuuGef

340

yHk(393)

xdktcg Copy Structure Dialog ay:vmrnf/ rdrdul;vdkonfh Structure atmifjrifpGmul;NyD;aMumif; Message Box ay:vmayrnf/ OK Command Button udka½G;yg/ yHk(394)/

yHk(394)

xdt k cg Lucky.mdb Database File xJwiG f Luck01 Table File ESit hf vm; o@mefwal om Luck02 Table File jzpfvmrnf/ yHk(395)/

yHk(395)


Contents Microsoft Visual Basic 6.0

uuuGef

341

uHprf;rJazgufrnfh y½d*k &rfa&;om;&eftwGuaf tmufyg Form yHpk u H w kd nfaqmuf &rnf/ yHk(396)/

yHk(396) yHk(396)yg Form yHpk w H iG yf g0ifaom Toolbox Icon rsm;rSm udak vhvmygu Label,

Text Box,

Command Button,

Data,

Frame wdkYyg0ifNyD;

4if;wdkY\ Properties rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm; a&;om;&rnfjzpfonf/ Label1 - Label Properties rSm (Name) Alignment AutoSize BackStyle BorderStyle Caption Font WordWrap

-

Label1 0 - Left Justify False Opaque 1 - Fixed Single J a&twGu)f uHprf;rnfhta&&twGuf (qkrt -Win---Kalaw, Bold, 18 False


Contents Microsoft Visual Basic 6.0

342

Label2 - Label Properties rSm (Name) Label2 Alignment 0 - Left Justify AutoSize False BackStyle Opaque BorderStyle 1 - Fixed Single h a&twGu)f Caption uHprf;rnfhta&&twGuf (uHprf;rnft Font -Win---Kalaw, Bold, 18 WordWrap False Label3 - Label Properties rSm (Name) Label3 Alignment 0 - Left Justify AutoSize False BackStyle Opaque BorderStyle 1 - Fixed Single J yH gwf) Caption qkrJeHygwf (qkre Font -Win---Kalaw, Bold, 18 WordWrap False Label4 - Label Properties rSm (Name) Label4 Alignment 0 - Left Justify AutoSize False BackStyle Opaque BorderStyle 1 - Fixed Single f rSw)f Caption uHxl;½SiftrSwf (uHx;l ½Sit Font -Win---Kalaw, Bold, 18 WordWrap False Label5 - Label Properties rSm (Name) Label5 Alignment 0 - Left Justify AutoSize False BackStyle Opaque

uuuGef


Contents Microsoft Visual Basic 6.0 BorderStyle Caption -

343

1 - Fixed Single qkrJeHygwf tm; uHxl;½SiftrSwf

(qkreJ yH gwf

tm; uHx;l ½Sit f rSwf

Font -Win---Kalaw, Bold, 18 WordWrap False Text1 - Text Properties rSm (Name) Text1 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font -Win---Kalaw, Bold, 18 Text Empty Text2 - Text Properties rSm (Name) Text2 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font -Win---Kalaw, Bold, 18 Text Empty Text3 - Text Properties rSm (Name) Text3 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font -Win---Kalaw, Bold, 18 Text Empty Text4 - Text Properties rSm (Name) Text4 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font -Win---Kalaw, Bold, 18 Text Empty tm;) Text5 - Text Properties rSm (qkrJeHygwf (Name) Text5 Alignment 0 - Left Justify

uuuGef rS &&½Sdygonf

rS &&½Syd gonf)


Contents Microsoft Visual Basic 6.0

344

uuuGef

BorderStyle 1 - Fixed Single Font -Win---Kalaw, Bold, 18 Text Empty rS &½Sdygonf) Text6 - Text Properties rSm (uHxl;½SiftrSwf (Name) Text6 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font -Win---Kalaw, Bold, 18 Text Empty S x f m;onf) Text7 - Text Properties rSm (uHprf;&ef Command Button atmuf0u (Name) Text7 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font -Win---Kalaw, Bold, 18 Text Empty Command1 - CommandButton Properties rSm (Name) Command1 Caption uHprf;&&ef (uHprf;&ef) BorderStyle 1 - Fixed Single Font -Win---Yadanapon, Bold, 22 Command2 - CommandButton Properties rSm (Name) Command2 Caption y½dk*&&rfrSxGuf&&ef (y½dk*&rfrSxGuf&ef) BorderStyle 1 - Fixed Single Font -Win---Innwa, Bold, 20 Command3 - CommandButton Properties rSm (Name) Command3 h ef) Caption uHprf;&&ef (uHprf;rJtrnfpm&if;Munf& BorderStyle 1 - Fixed Single Font -Win---Innwa, Bold, 20 k ak tmuf0u S x f m;&rnf/) Data1 - Data Properties rSm(rjrifap&efwpfcc (Name) Data1


Contents Microsoft Visual Basic 6.0

345

uuuGef

Align None BOFAction 0 - Move First Caption Data1 Connect Access DatabaseName C:\Program Files\LuckyDraw\Lucky.mdb EOFAction 0 - Move Last Font MS Sans Serif, Regular, 8 RecordsetType 0 - Table Frame1 - Frame Properties rSm (Name) Frame1 BorderStyle 1 - Fixed Single Caption Empty Font MS Sans Serif, Regular, 8 Frame2 - Frame Properties rSm (Name) Frame2 BorderStyle 1 - Fixed Single Caption Empty Font MS Sans Serif, Regular, 8 Frame3 - Frame Properties rSm (Name) Frame3 BorderStyle 1 - Fixed Single Caption Empty Font MS Sans Serif, Regular, 8 Frame4 - Frame Properties rSm (Name) Frame4 BorderStyle 1 - Fixed Single Caption Empty Font MS Sans Serif, Regular, 8


Contents Microsoft Visual Basic 6.0

346

(General), (Declaration) twGuf Dim MyDb As Database, MyData As Recordset uHprf;&ef Command Button1 twGuf Private Sub Command1_Click() Dim MyDb As Database, MyData As Recordset Dim zaw As Boolean Dim a, b As Integer a = Val(Text1) b = Val(Text3) If Text1 <> Empty Then Text5 = b + 1 Text3 = b + 1 Text5 = Text3 If b + 1 >= a Then Text3 = b + 1 Text5 = b + 1 Text6 = 0 Command1.Visible = False Form2.Show End If Text5.ForeColor = "255" Else Form3.Show End If Text6.ForeColor = "0" '''''''' zaw = True Set MyDb = Workspaces(0).OpenDatabase("c:\Program Files\ LuckyDraw\Lucky.mdb") Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable) MyData.MoveFirst c = Text2

uuuGef


Contents Microsoft Visual Basic 6.0

347

uuuGef

sn = Text3 en = 0 d = Int(Rnd() * c) + 1 Do While zaw = True MyData.Index = "Luckno" MyData.Seek "=", d If MyData.NoMatch Then zaw = False Else d = Int(Rnd() * c + 1) End If Loop Text6 = d Text4 = d MyData.AddNew MyData("Luckno") = Text6 MyData.Update Text6.ForeColor = "65535" Text7 = 0 Data1.Refresh End Sub y½dk*&rfrSxGuf&ef Command Button2 twGuf Private Sub Command2_Click() Unload Me End End Sub uHprf;rJtrnfpm&if;Munfh&ef Command Button3 twGuf Private Sub Command3_Click() Dim MyDb As Database, MyData As Recordset, MyDatapp As Recordset Dim ss As Integer Set MyDb = Workspaces(0).OpenDatabase("c:\Program Files\ LuckyDraw\Lucky.mdb")


Contents Microsoft Visual Basic 6.0

348

uuuGef

Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable) Set MyDatapp = MyDb.OpenRecordset("Luck02", dbOpenTable) If MyDatapp.RecordCount > 0 Then MyDatapp.MoveFirst Do While MyDatapp.EOF = False MyDatapp.Delete MyDatapp.MoveNext Loop End If MyData.MoveFirst ss = 0 Do While MyData.EOF = False yy = MyData("Luckno") If yy < 9999 And yy <> 0 Then MyDatapp.AddNew MyDatapp("Luckno") = yy MyDatapp("srno") = ss MyDatapp.Update End If MyData.MoveNext ss = ss + 1 Loop MyDatapp.MoveFirst Form5.Show End Sub Data1 Reposition twGuf Private Sub Data1_Reposition() Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1) End Sub


Contents Microsoft Visual Basic 6.0

uuuGef

349

Form Load twGuf Private Sub Form_Load() Set MyDb = Workspaces(0).OpenDatabase("C:\Program Files\ LuckyDraw\Lucky.mdb") Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable) MyData.AddNew MyData("Luckno") = 0 MyData.Update Data1.Refresh End Sub Form Unload twGuf Private Sub Form_Unload(Cancel As Integer) Set MyDb = Workspaces(0).OpenDatabase("c:\Program Files\ LuckyDraw\Lucky.mdb") Set MyData = MyDb.OpenRecordset("Luck01", dbOpenTable) MyData.MoveFirst Do Until MyData.EOF MyData.Delete MyData.MoveNext Loop Data1.Refresh End Sub Lucky Draw Program Bu;D udk Run Ă­&Edkifap&ef yHk(397)wGifyg0ifaom Form k nfaqmuf&ayrnf/ File rsm;udw

yHk(397)


Contents Microsoft Visual Basic 6.0

350

uuuGef

qufvufí Form2 udw k nfaqmuf&ayrnf/ yH(k 398)/

yHk(398)

yHk(398)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;rSm udak vhvmygu Label,

Command Button,

Frame wdy Yk g0ifNy;D 4if;wd\ Yk Properties rsm;udk

k yfaomy½d*k &rfrsm; a&;om; jyifqifjznfph u G Nf y;D aemuf Command Button rsm;wGif vdt &rnfjzpfonf/ Label1 - Label Properties rSm (Name) Label1 Alignment 2 - Center AutoSize False BackStyle Opaque BorderStyle 0 - None Caption uHprf;rJukefaeygNyD (uHprf;rJukefaeygNyD) Font -Win---Taungyi, Bold, 26 WordWrap False Frame1 - Frame Properties rSm (Name) Frame1 BorderStyle 1 - Fixed Single Caption Empty Font MS Sans Serif, Regular, 8


Contents Microsoft Visual Basic 6.0

351

uuuGef

Command1 - CommandButton Properties rSm (Name) Command1 f ef) Caption ydwf&&ef (ydw& BorderStyle 1 - Fixed Single Font -Win---Yadanapon, Bold, 28 ydwf&ef Command Button1 twGuf Private Sub Command1_Click() Form2.Hide Unload Form2 End Sub

qufvufí Form3 udw k nfaqmuf&ayrnf/ yH(k 399)/

yHk(399)

yHk(399)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;rSm udak vhvmygu Label,

Command Button,

Frame wdy Yk g0ifNy;D 4if;wd\ Yk Properties rsm;udk

jyifqifjznfph u G Nf y;D aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm; a&;om; &rnfjzpfonf/ Label1 - Label Properties rSm (Name) Alignment

-

Label1 2 - Center


Contents Microsoft Visual Basic 6.0

352

uuuGef

AutoSize False BackStyle Opaque BorderStyle 0 - None f nf&h ef) Caption uHprf;rJta&&twGufxnfhyg (uHprf;rJta&twGux Font -Win---Taungyi, Bold, 24 WordWrap False Frame1 - Frame Properties rSm (Name) Frame1 BorderStyle 1 - Fixed Single Caption Empty Font MS Sans Serif, Regular, 8 Command1 - CommandButton Properties rSm (Name) Command1 f ef) Caption ydwf&&ef (ydw& BorderStyle 1 - Fixed Single Font -Win---Yadanapon, Bold, 28 ydwf&ef Command Button1 twGuf Private Sub Command1_Click() Form3.Hide Unload Form3 Form1.Show End Sub

qufvufĂ­ Form4 udw k nfaqmuf&ayrnf/ yH(k 400)/

yHk(400)


Contents Microsoft Visual Basic 6.0

353

uuuGef

yHk(400)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;rSm udak vhvmygu Label,

Command Button,

Frame wdy Yk g0ifNy;D 4if;wd\ Yk Properties rsm;udk

jyifqifjznfph u G Nf y;D aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rfrsm; a&;om; &rnfjzpfonf/ Label1 - Label Properties rSm (Name) Alignment AutoSize BackStyle BorderStyle Caption

-

Label1 2 - Center False Opaque 0 - None qkrJwpfcktwGufwpfBudrfomESdyfyg

(qkrw J pfct k wGuw f pfBurd o f mESyd yf g) Font -Win---Kalaw, Bold, 22 WordWrap False Frame1 - Frame Properties rSm (Name) Frame1 BorderStyle 1 - Fixed Single Caption Empty Font MS Sans Serif, Regular, 8 Command1 - CommandButton Properties rSm (Name) Command1 f ef) Caption ydwf&&ef (ydw& BorderStyle 1 - Fixed Single Font -Win---Yadanapon, Bold, 28 ydwf&ef Command Button1 twGuf Private Sub Command1_Click() Form4.Hide Unload Form4 End Sub


Contents Microsoft Visual Basic 6.0

354

uuuGef

qufvufí Form5 udw k nfaqmuf&ayrnf/ yH(k 401)/

yHk(401)

yHk(401)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;rSm udkavhvmygu DBGrid, Data, Command ButtonwdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udk jyifqifjznfph u G Nf y;D aemuf Command Button wGif vdt k yfaomy½d*k &rfrsm; a&;om;&rnf jzpfonf/ DBGrid1 - DBGrid Properties rSm (Name) Align AllowAddNew AllowArrows AllowDelete

-

DBGrid1 0 - vbAlignNone False True False


Contents Microsoft Visual Basic 6.0

355

uuuGef

AllowUpdate True BorderStyle 1 - Fixed Single Caption None DataMode 0 - Bound DataSource Data1 Font MS Sans Serif, Regular, 8 Data1 - Data Properties rSm (Name) Data1 Align 0 - None BOFAction 0 - Move First Connect Access DatabaseFile C:\Program Files\LuckyDraw\Lucky.mdb EOFAction 0 - Move Last Font MS Sans Serif, Regular, 8 RecordsetType 1 - Dynaset RecordsetSource Luck02 Command1 - CommandButton Properties rSm (Name) Command1 f ef) Caption ydwf&&ef (ydw& BorderStyle 1 - Fixed Single Font -Win---Yadanapon, Bold, 20 ydwf&ef Command Button1 twGuf Private Sub Command1_Click() Unload Me End Sub Data1 Reposition twGuf Private Sub Data1_Reposition() Data1.Caption = " Record: " & (Data1.Recordset.AbsolutePosition + 1) End Sub

tqdyk g y½d*k &rfukd Run ygu yH(k 402)ygtwdik ;f jrifawGU&rnf/


Contents Microsoft Visual Basic 6.0

uuuGef

356

yHk(402) Oyrm - qkrt J a&twGuf 6 ckom½SNd y;D ? uHrpJ rf;&rnft h a&twGurf mS 125 OD;½Syd gu qkrt J a&twGun f mzuf½dS tqdyk g y½d*k &rfukd Run ygu yH(k 402)ygtwdik ;f jrifawGU&rnf/ qkrJta&twGuf 6 ck½Sdojzifh uHprf;&ef Command Button tm; 6 cgESdyfNyD;ygu uHprf;rJuek af eygNy[ D al om Message Box jyvmrnf/ yHk(403)/

yHk(403)

tqdyk g Message Box tm; ydw&f ef Command Button udEk ydS yf gu Message hf nf/ yH(k 404)/ Box aysmufoGm;NyD;? uHprf;&ef Command Button ygaysmufomG ;vdrr


Contents Microsoft Visual Basic 6.0

357

uuuGef

yHk(404) uHprf;rJtrnfpm&if;Munf&h ef Command Button udEk ydS yf gu yH(k 405)ygtwdik ;f jrifawGU &rnf/

yHk(405)

txufyg Form yHpk w H iG f ydw&f ef Command Button udak ½G;cs,yf gu rlvuHprf;rJEu Id f onfh Form yHkpHodkYjyefvnfa&muf½SdoGm;NyD;? y½dk*&rfrSxGuf&ef Command Button udEk ydS yf gu tqdyk g Form yHpk rH x S u G o f mG ;vdrrhf nf/ ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

358

uuuGef

ODBC jzifhzefwD;xm;aom Access zdkifudktouf? vkyfouf? yifpif,lrnfhESpfwGufjcif; Access 2000 (or) Access 2002 wdkYjzifh Database File wpfcu k w kd nfaqmufxm; &rnf/ 4if; Database File rS Table File wGiaf tmufygtwdik ;f wnfaqmufxm;Ny;D Record rsm;xnfx h m;&rnf/ Field Name Data Type Field Size IDNo Text 8 Name Text 30 Date of Birth Date Enrolment Date Age Number Double, Fixed, Decimal 2 Services Year Number Double, Fixed, Decimal 2 Retire Year Date Oyrm - Retire [k Database File, Table File wdw Yk iG t f rnfay;xm;yg/ xdaYk emuf 4if;zdkifudk ODBC \vkyfydkifcGifhodkYajymif;vJNyD; Microsoft Visual Basic 6.0 jzifh atmufazmfjyyg Form yHpk u H w kd nfaqmufxm;&rnf/

yHk(406) yHk(406)yg Form yHkpHwGif , , rsm;jzifh zefwD;xm;NyD; oufqdkif&m Properties rsm;wGifjyifqifjznfhpGufNyD;aemuf Command k yfaomy½d*k &rfrsm;a&;om;&ef jzpfygonf/ Button rsm;wGif vdt


Contents Microsoft Visual Basic 6.0

359

uuuGef

Adodc1 - Adodc Properties twGuf (Name) Adodc1 Align 0 - vbAlignNone BOFAction 0 - adDoMoveFirst ConnectingString provider=msdasql;dsn=retire;uid=;pwd=; EOFAction 0 - adDoMoveLast Font MS Sans Serif, Bold, 8 RecordSource select [IDNo], Name, [Date of Birth], [Enrolment], Age, [Services Year], [Retire Year] from retire order by [IDNo] DataGrid1 - DataGrid Properties twGuf (Name) DataGrid1 Align 0 - vbAlignNone AllowAddNew False AllowArrows True AllowDelete False AllowUpdate True Font MS Sans Serif, Regular, 8 DataSource Adodc1 Adodc1 - Adodc \ Record Position twGuf Private Sub a1_MoveComplete(ByVal adReason As ADODB.EventReason Enum, ByVal pError As ADODB.Error, adStatus As ADODB.Event StatusEnum, ByVal pRecordset As ADODB.Recordset) Adodc1.Caption = "Record: " & CStr(Adodc1.Recordset.AbsolutePosition)

End Sub Age Command Button twGuf Private Sub Command1_Click() Adodc1.Recordset.MoveFirst Do While Adodc1.Recordset.EOF = False x = (Date - Adodc1.Recordset("Date of Birth")) / 365.25 Adodc1.Recordset("Age") = x Adodc1.Recordset.MoveNext Loop Adodc1.Recordset.MoveFirst End Sub


Contents Microsoft Visual Basic 6.0

360

uuuGef

Services Command Button twGuf Private Sub Command2_Click() Adodc1.Recordset.MoveFirst Do While Adodc1.Recordset.EOF = False y = (Date - Adodc1.Recordset("Enrolment")) / 365.25 Adodc1.Recordset("Services Year") = y Adodc1.Recordset.MoveNext Loop Adodc1.Recordset.MoveFirst End Sub Retire Year Command Button twGuf Private Sub Command3_Click() Adodc1.Recordset.MoveFirst Do While Adodc1.Recordset.EOF = False mdy = Adodc1.Recordset("Date of Birth") myear = Year(mdy) + 60 mmth = Month(mdy) mday = Day(mdy) zzz = mday & "-" & mmth & "-" & myear Adodc1.Recordset("Retire Year") = zzz Adodc1.Recordset.MoveNext Loop Adodc1.Recordset.MoveFirst End Sub Exit Command Button twGuf Private Sub Command4_Click() Unload Me End End Sub

tqdyk gy½d*k &rfukd Run ygu yH(k 406)ygtwdik ;f jrifawGU&rnf/ Age Command Button udk ESyd yf gu toufrsm;wGucf suaf y;rnfjzpfNy;D ? Services Year Command Button udk ESyd yf gu trIxrf;oufrsm;wGucf suaf y;vdrrhf nf/ Retire Year Comamand Button udk ESyd yf gu yifpif,rl nfh &uf? v? ckEpS w f u Ykd w kd u G cf suaf y;vdrrhf nf/ yH(k 407)/


Contents Microsoft Visual Basic 6.0

361

yHk(406)

yHk(407)

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

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

362

Visual Basic 6.0 jzifhzefwD;xm;aom Access zdkifudk Printer jzifh½dkufxkwfjcif; Visual Basic 6.0 jzifhyif Database File wpfcu k w kd nfaqmufxm;&rnf/ 4if; Database File rS Table File wGiaf tmufygtwdi k ;f wnfaqmufxm;Ny;D Record rsm;

xnfx h m;&rnf/ Field Name Data Type Field Size IDNo Text 8 Name Text 25 Date of Birth Date Enrolment Date Age Double Services Year Double Retire Year Date Oyrm - Retired [k Database File, Table File wdw Yk iG t f rnfay;xm;yg/ xdaYk emuf Microsoft Visual Basic 6.0 jzifh atmufazmfjyyg Form yHp k u H w kd nfaqmufxm;&rnf/

yHk(408)

yH(k 408)yg Form yHpk w H iG f rsm;jzifh zefw;D xm;Ny;D oufqikd &f m Proph u G Nf y;D aemuf Command Button rsm;wGif vdt k yfaomy½d*k &rf erties rsm;wGijf yifqifjznfp rsm;a&;om;&ef jzpfygonf/ Report Command Button twGuf Private Sub Command1_Click() Command3.Visible = True Command4.Visible = True End Sub


Contents Microsoft Visual Basic 6.0

363

uuuGef

Exit Command Button twGuf Private Sub Command2_Click() Command3.Visible = False Command4.Visible = False Unload Me End End Sub Soft Copy Command Button twGuf Private Sub Command3_Click() Form3.Show End Sub Hard Copy Command Button twGuf Private Sub Command4_Click() Form2.Show End Sub Form Load twGuf Private Sub Form_Load() Command3.Visible = False Command4.Visible = False End Sub

f gu Form2.Show [ky½d*k &rfa&;om; Soft Copy Command Button udak ½G;cs,y xm;ojzifh Form2 udyk (kH 409)ygtwdik ;f zefw;D wnfaqmuf&rnf/


Contents Microsoft Visual Basic 6.0

364

uuuGef

yHk(409) yHk(409)yg Form yHkpHwGifyg0ifaom Toolbox Icon rsm;rSm udkavhvmygu DBGrid, Label, Text Box, Data, Command ButtonwdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udk jyifqifjznfhpGufNyD;aemuf Command Button wGif vdt k yfaomy½d*k &rfrsm; a&;om;&rnf jzpfonf/ DBGrid1 - DBGrid Properties rSm (Name) DBGrid1 Align 0 - vbAlignNone AllowAddNew False AllowArrows True AllowDelete False AllowUpdate True BorderStyle 1 - Fixed Single Caption None DataMode 0 - Bound DataSource Data1 Font MS Sans Serif, Regular, 8 Label1 - Label Properties rSm (Name) Label1 Alignment 0 - Left Justify AutoSize False


Contents Microsoft Visual Basic 6.0

365

uuuGef

BackStyle 0 - Transparent BorderStyle 1 - Fixed Single Caption All Records Font MS Sans Serif, Bold, 8 Text1 - Text Properties rSm (Name) Text1 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font MS Sans Serif, Bold, 8 Text Empty Data1 - Data Properties rSm (Name) Data1 Align 0 - None BOFAction 0 - Move First Connect Access DatabaseFile C:\Program Files\Microsoft Visual Studio\VB98\ Retired.mdb EOFAction 0 - Move Last Font MS Sans Serif, Regular, 8 RecordsetType 1 - Dynaset RecordsetSource Retired Command1 - CommandButton Properties rSm (Name) Command1 Caption To Calculate Age Font MS Sans Serif, Regular, 8 Command2 - CommandButton Properties rSm (Name) Command2 Caption To Calculate Services Year Font MS Sans Serif, Regular, 8 Command3 - CommandButton Properties rSm (Name) Command3 Caption To Calculate Retire Year Font MS Sans Serif, Regular, 8


Contents Microsoft Visual Basic 6.0

366

Command4 - CommandButton Properties rSm (Name) Command4 Caption &Return to Main Menu Font MS Sans Serif, Regular, 8 To Calculate Age Command Button1 twGuf Private Sub Command1_Click() Set MyDb = Workspaces(0).OpenDatabase("Retired.mdb") Set MyData = MyDb.OpenRecordset("Retired", dbOpenTable) MyData.MoveFirst Do While MyData.EOF = False MyData.Edit x = (Date - MyData("Date of Birth")) / 365.25 MyData("Age") = x MyData.Update MyData.MoveNext Loop MyData.MoveFirst End Sub To Calculate Services Year Command Button2 twGuf Private Sub Command2_Click() Set MyDb = Workspaces(0).OpenDatabase("Retired.mdb") Set MyData = MyDb.OpenRecordset("Retired", dbOpenTable) MyData.MoveFirst Do While MyData.EOF = False MyData.Edit y = (Date - MyData("Enrolment")) / 365.25 MyData("Services Year") = y MyData.Update MyData.MoveNext Loop MyData.MoveFirst End Sub

uuuGef


Contents Microsoft Visual Basic 6.0

367

uuuGef

To Calculate Retire Year Command Button3 twGuf Private Sub Command3_Click() Set MyDb = Workspaces(0).OpenDatabase("Retired.mdb") Set MyData = MyDb.OpenRecordset("Retired", dbOpenTable) MyData.MoveFirst Do While MyData.EOF = False MyData.Edit mdy = MyData("Date of Birth") myear = Year(mdy) + 60 mmth = Month(mdy) mday = Day(mdy) zzz = mday & "-" & mmth & "-" & myear MyData("Retire Year") = zzz MyData.Update MyData.MoveNext Loop MyData.MoveFirst End Sub Return to Main Menu Command Button4 twGuf Private Sub Command4_Click() Unload Me End Sub Data1 Reposition twGuf Private Sub Data1_Reposition() Data1.Caption = " Record: " & (Data1.Recordset.AbsolutePosition + 1) End Sub Form Load twGuf Private Sub Form_Load() Set MyDb = Workspaces(0).OpenDatabase("Retired.mdb") Set MyData = MyDb.OpenRecordset("Retired", dbOpenTable) MyData.MoveLast Text1.Text = MyData.RecordCount End Sub


Contents Microsoft Visual Basic 6.0

368

uuuGef

tqdyk gy½d*k &rfukd Run ygu yHk(410)ygtwdkif;jrifawGU&rnf/ To Calculate Age k ydS yf gutoufrsm;wGucf suaf y;rnfjzpfNy;D ? To Calculate SerCommand Button udE k ydS yf gu trIxrf;oufrsm;wGucf suaf y;vdrrhf nf/ To vices Year Command Button udE k ydS yf guyifpif,rl nfh &uf? v? ckEpS f Calculate Retire Year Comamand Button udE wdu Yk w kd u G cf suaf y;vdrrhf nf/

yHk(410)


Contents Microsoft Visual Basic 6.0

369

uuuGef

Hard Copy Command Button udak ½G;cs,y f gu Form3.Show [ky½d*k &rfa&;om; xm;ojzifh Form3 udyk (kH 411)ygtwdik ;f zefw;D wnfaqmuf&rnf/

yHk(411)

yHk(411)yg Form yHpk w H iG yf g0ifaom Toolbox Icon rsm;rSmudak vhvmygu Label, Crstal Report, Combo Box, Command Buttonwdy Yk g0ifNy;D 4if;wd\ Yk Properties rsm;udk jyifqifjznfp h u G Nf y;D aemuf Command Button wGif vdt k yfaomy½d*k &rf rsm;a&;om;&rnf jzpfonf/ Combo1 - ComboBox Properties rSm (Name) Font ItemData

-

List

-

Combo1 MS Sans Serif, Regular, 8 (List) 0 ^ Enter jzifh½dkuf&ef 0 [List] Window ^ Enter jzifh½dkuf&ef Printer 0 - DropdownCombo Window

Style Text Label1 - Label Properties rSm (Name) Label1 Alignment 2 - Center


Contents Microsoft Visual Basic 6.0

370

AutoSize False BackStyle 0 - Transparent BorderStyle 0 - None Caption Using Crystal Report Font MS Sans Serif, Bold, 14 Label2 - Label Properties rSm (Name) Label2 Alignment 0 - Left Justify AutoSize False BackStyle 0 - Transparent BorderStyle 0 - None Caption Print Destination Font MS Sans Serif, Bold, 10 Label3 - Label Properties rSm (Name) Label3 Alignment 0 - Left Justify AutoSize False BackStyle 0 - Transparent BorderStyle 0 - None Caption Identification Number From Font MS Sans Serif, Bold, 10 Label4 - Label Properties rSm (Name) Label4 Alignment 0 - Left Justify AutoSize False BackStyle 0 - Transparent BorderStyle 0 - None Caption To Font MS Sans Serif, Bold, 10 Report1 - Crystal Report Properties rSm (Name) Report1 Destination 0 - crptToWindow

uuuGef


Contents Microsoft Visual Basic 6.0

371

PrintFileType 0 - crptRecord RecordSource 0 - crptReport WindowState 0 - crptNormal Text1 - Text Properties rSm (Name) Text1 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font MS Sans Serif, Regular, 8 Text A-00001 Text2 - Text Properties rSm (Name) Text2 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font MS Sans Serif, Regular, 8 Text A-99999 Combo Box a½G;cs,f&eftwGuf Private Sub Combo1_Click() If Combo1.Text = "Printer" Then Form4.Show End If End Sub Print Report Command Button twGuf Private Sub Command1_Click() If Combo1.Text = "Window" Then rpt1 = 0 Else Combo1.Text = "Printer" rpt1 = 1 Report1.CopiesToPrinter = num1 End If pt1 = "{Retired.IDNo} in '" + Trim(Text1.Text) + "' to '" + Trim(Text2.Text) + "'"

uuuGef


Contents Microsoft Visual Basic 6.0

372

uuuGef

Report1.SelectionFormula = pt1 Report1.Destination = rpt1 a1 = LCase(App.Path) If Right(App.Path, 1) <> "\" Then a1 = a1 + "\" 'Handles the root Report1.DataFiles(0) = a1 + "Retired.mdb" Report1.ReportFileName = a1 + "Retired.rpt" Report1.Action = 1 End Sub

tqdyk gy½d*k &rfukd Run ygu yH(k 412)ygtwdik ;f jrifawGU&rnf/ Print Destination nmzuf½dS Combo Box Dropdown Arrow udak ½G;cs,yf gu Window ESifh Printer [l íjrifawGU&Ny;D rdrt d vd½k &dS mudak ½G;cs,Ef ikd yf gonf/ Identification Number From \nm zuf Text Box wGif Record Identification Number rdrdpvdkonfh eHygwfrSp&efjzpfNyD; To \nmzuf Text Box ürdrt d qH;k owf½u kd Ef ydS v f o kd nfh Record Identification Number udjk yifqifjznfph u G &f efjzpfonf/ Print Report Command Button udEk ydS yf gu Combo f yhJ gu Printer jzif½h u kd Ef ydS &f ef Print Preview udk jyrnfjzpfNy;D Box udk Window a½G;cs,c Printer udak ½G;cs,c f yhJ gu wdu k ½f u kd f Printer jzifh ½du k Ef ydS rf nfjzpfygonf/

yHk(412)


Contents Microsoft Visual Basic 6.0

373

uuuGef

Combo Box wGif Printer udak ½G;cs,y f gu Form4.Show [ky½d*k &rfa&;om;xm;jzifh Form4 udy k (kH 413)ygtwdik ;f zefw;D wnfaqmuf&rnf/

yHk(413)

yHk(413)yg Form yHpk w H iG yf g0ifaom Toolbox Icon rsm;rSmudak vhvmygu LaText Box, Command ButtonwdkYyg0ifNyD; 4if;wdkY\ Properties rsm;udk bel, jyifqifjznfph u G Nf y;D aemuf Command Button wGif vdt k yfaomy½d*k &rfrsm;a&;om;&rnf jzpfonf/ Label1 - Label Properties rSm (Name) Label1 Alignment 0 - Left Justify BackStyle 0 - Transparant BorderStyle 0 - None Caption Please enter the number of copies Font MS Sans Serif, Bold, 10 Label2 - Label Properties rSm (Name) Label2 Alignment 0 - Left Justify BackStyle 0 - Transparant BorderStyle 0 - None Caption you wish to print Font MS Sans Serif, Bold, 10


Contents Microsoft Visual Basic 6.0

374

Text1 - TextBox Properties rSm (Name) Text1 Alignment 0 - Left Justify BorderStyle 1 - Fixed Single Font MS Sans Serif, Bold, 10 Text 1 Command1 - CommandButton Properties rSm (Name) Command1 Caption Accept Number of Copies Font MS Sans Serif, Bold, 10 Command2 - CommandButton Properties rSm (Name) Command2 Caption Reset Number of Copies Font MS Sans Serif, Bold, 10 Command1 twGuf Private Sub Command1_Click() num1 = Text1 Form4.Hide End Sub Command2 twGuf Private Sub Command2_Click() Text1.Text = "1" End Sub ---------------0-0-0---------------

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

375

tcef;(11) Visual Basic 6.0 jzifh Program wpfcktm;a&;NyD; Execute File wnfaqmufjcif; yxrtqift h aejzifh Microsoft Visual Basic 6.0 jzifh Program wpfy'k af &;om;yg/ Oyrm - vuf½EdS pS -f v-&uf-em&D-rdepf-puúeu Yf jkd yaom Program wpfy'k u f akd &;om;xm;& rnf/ zdik \ f y½d*k &rftrnfukd extest017.vbp [ktrnfowfrw S x f m;Ny;D Form File udk extest017 .frm [ktrnfowfrw S yf g/ yH(k 414)/

yHk(414)

txufygzdik u f kd Execute File vkyrf nfqykd gu Menu Bar ½Sd File udka½G;yg/ Pull f rnf/ yH(k 415)/ Down Menu usvmygu 4if;xJrS Make extest017.exe... udak ½G;cs,&


Contents Microsoft Visual Basic 6.0

uuuGef

376

yHk(415)

txufygzdik u f kd Execute File vkyrf nfqykd gu Menu Bar ½Sd File udka½G;yg/ Pull f rnf/ yH(k 415)/ Down Menu usvmygu 4if;xJrS Make extest017.exe... udak ½G;cs,&

yHk(416)


Contents Microsoft Visual Basic 6.0

377

uuuGef

xdt k cg Make Project Dialog Box ay:vmrnf/ rdrdodrf;vdkonfhvrf;aMumif;? rdro d rd ;f vdo k nfh zdik t f rnfukd jyKjyifjznfph u G Ă­ f Execute File udw k nfaqmufEikd af yonf/ yHk(417)? yHk(418)/

yHk(417)

yHk(418)


Contents Microsoft Visual Basic 6.0

uuuGef

378

xdt k cgrdrt d rnfay;vdu k o f nft h wdik ;f c:\Example001.exe jzpfomG ;ayrnf/ 4if;zdik u f kd Run vdy k gu Computer Desktop wGi½f adS eaom My Computer Short Cut Icon udk Double Click (or) Active jzpfaeaomtcg Enter ESdyfyg/ yHk(419)/

yHk(419)

xdt k cg yH(k 420)wGiaf zmfjyxm;onft h wdik ;f [C:] udk Double Click (or) Active jzpfaeaomtcg Enter ESdyfyg/

yHk(420)


Contents Microsoft Visual Basic 6.0

379

uuuGef

yHk(421)

yH(k 421)wGijf rifawGUae&aom Example001.exe zdik u f kd Run vdyk gu Double Click (or) Active jzpfaeaomtcg Enter ESdyfyg/

yHk(422)


Contents Microsoft Visual Basic 6.0

uuuGef

380

yHk(422)wGifjrifawGUae&aom Date and Time Testing Form tm; Command f gu yH(k 423)ygtwdik ;f &ufp?GJ tcsed rf sm;azmfjyrnf/ Button wpfcjk zpfaom Run udak ½G;cs,y 4if;y½d*k &rfrx S u G v f ykd gu Close Button udak ½G;cs,&f rnf/

yHk(423)

Execute File jyKvy k í f &onft h wGuf Start ® Run ® c:\Example001 (or) c:\Example001.exe ® OK udka½G;cs,fjcif;jzifhvnf;aumif;? Start ® Run ® command ® OK ud k a ½G ; cs,f N yD ; DOS Prompt rS C:\>Example001 (or) k af yonf/ Example001.exe ® Enter uddkESdyfjcif;jzifhvnf;aumif; y½dk*&rfudk Run Edi Visual Basic 6.0 Language r½Sad omtjcm;pufrsm;odu Yk ;l ,lNy;D vnf; Run Edik af yonf/ ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

uuuGef

381

Visual Basic 6.0 jzifh Program wpfcktm;a&;NyD; Package jyKvkyfjcif; yxrtqift h aejzifh Microsoft Visual Basic 6.0 jzifh Program wpfy'k af &;om;yg/ Oyrm - Database File wpfzikd w f nfaqmufNy;D Record tenf;i,foiG ;f xm;&rnf/ tqdyk g Database File wGi½ f dS Record tcsKUd udk wGucf suaf y;onfh y½d*k &rfwpfy'k t f m; a&;om;xm; &rnf/ zdik \ f y½d*k &rftrnfukd extest111.vbp [ktrnfowfrw S x f m;Ny;D Form File udk extest111 .frm [ktrnfowfrw S yf g/ yH(k 424)/

yHk(424) txufygzdik u f kd Application Package vkyrf nfqykd gu 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(425)


Contents Microsoft Visual Basic 6.0

382

uuuGef

xdt k cg Package and Deployment Wizard Dialog Box ay:vmrnf/ yHk(426)? Package rjyKvy k cf iftqdyk g Project File udo k rd ;f vdyk gu Yes udka½G;&efjzpfNyD;? rodrf;vdk ygu No udak ½G;cs,&f rnf/ yH(k 426)/ Oyrm - No udak ½G;yg/

yHk(426) Package and Deployment Wizard Dialog Box ay:vmrnf/ 4if; Dialog f o kd nfh Visual Basic Project File \ wnfae&mudk Box wGif rdrd Package vkyv jyaernfjzpfNyD; Package Command Button udak ½G;cs,&f rnf/ yH(k 427)/

yHk(427)

xdak emuf Compile Command Button udak ½G;cs,&f rnf/ xdt k cgrSom Execute File &½Sdayrnf/ yHk(428)/


Contents Microsoft Visual Basic 6.0

383

uuuGef

yHk(428)

Compile vkyfNyD;oGm;ygu yHk(429)yg Dialog Box ay:vmygu Yes Command f g/ Button udak ½G;cs,y

yHk(429) Package trsK;d tpm;a½G;cs,o f nfh Dialog Box ay:vmrnf/ Package Type udk Standard Setup Package ae&mwGiy f ifxm;í Next udak ½G;cs,yf g/ yH(k 430)/

yHk(430) Package udr k rd x d nfv h o kd nfv h rf;aMumif;üxnf&h eftcGit hf a&;&½Srd nfh Dialog Box

ay:vmrnf/ yHk(431)/


Contents Microsoft Visual Basic 6.0

384

uuuGef

yHk(430)

yHk(431) tqdyk g Dialog Box wGifyif Folder udkajymif;í Next udka½G;cs,fyg/ yHk(432)/

yHk(432) DAO Driver rsm;udka½G;cs,f&eftajctaeayonfh Dialog Box ay:vmygu zdik t f m;vH;k udak ½G;cs,Nf y;D Next udk Click ESdyf&rnf/ yHk(433)/


Contents Microsoft Visual Basic 6.0

385

uuuGef

yHk(433) Folder vrf;aMumif;topfa½G;cs,fojzifh ayskmufaeonfh *.dll zdkifrsm;pm&if; udjk yaevdrrhf nf/ rnfoyYkd ifjzpfap OK udk Click ESdyf&rnfjzpfonf/ yHk(434)/

yHk(434)

Out-of-Date Dependency Information Dialog Box xyfraH y:vmrnf/ OK udo k m Click ESdyf&rnfjzpfonf/ yHk(435)/


Contents Microsoft Visual Basic 6.0

386

uuuGef

yHk(435)

rdrw d nfaqmufrnfh Application Package wGif yg0ifonfh *.dll zdkifrsm;udk Check f m;onf/ ra½G;cs,v f ykd gu Uncheck jyKvyk Ef ikd o f nf/ tm;vH;k a½G;cs,f Box jzifh Mark vkyx xm;ojzifh Next Command Button udo k ma½G;cs,yf g/ yH(k 436)/

yHk(436) Cab File wnfaqmuf&eftcGifhta&;ay;onfh Dialog Box wpfckay:vmrnf/ tqdyk g Dialog Box wGif Single cab File wnfaqmufygu cab File wpfzikd w f nf;om wnfaqmufNy;D Disk Space rsm;vdrrhf nf/ Multiple cabs Option Button udak ½G;cs,f ygu rdrw d nfaqmufvo kd nfh cab size udk 1.44 MB, 2.88 MB, 1.2 Mb, 720KB ponfjzifah ½G;cs,w f nfaqmufEikd af yonf/ Oyrm - 1.44 MB udak ½G;cs,yf gu jzpfay:vm


Contents Microsoft Visual Basic 6.0

387

uuuGef

aom cab File rsm;onf 1.44 MB xufrausmaf pbJ cab File rsm;wpfzikd x f ufru jzpfvmayrnf/ tqdyk g Dialog Box wGif Multiple cabs Option Button udak ½G;cs,yf g/ xdaYk emuf Cab size udk 1.44 MB wGix f m;Ny;D Next Command Button udak ½G;cs,&f efjzpf onf/ yH(k 437)/

yHk(437)

Installation Title udo k wfrw S &f ef Dialog Box xyfraH y:vmrnf/ Installation d w d Bf uKu d o f wfrw S yf g/ Oyrm - Result of the Students [kjyifqifjznfph u G í f title tm;rdrp Next udak ½G;cs,& f rnf/ yH(k 438)/

yHk(438) Package and Deployment Wizard - Start Menu Items Dialog Box ay:vm rnf/ Next udka½G;cs,fyg/ yHk(439)/


Contents Microsoft Visual Basic 6.0

388

uuuGef

yHk(439)

Package and Deployment Wizard - Install Locations Dialog Box ay:vm rnf/ Next udka½G;cs,fyg/ yHk(440)/

yHk(440) Package and Deployment Wizard - Shared Files Dialog Box ay:vmrnf/ Shared Files rsm;udk Check jyKvy k í f Next udak ½G;cs,yf g/ yH(k 441)/


Contents Microsoft Visual Basic 6.0

389

uuuGef

yHk(441) Package and Deployment Wizard - Finished! Dialog Box ay:vmrnf/ Finish udka½G;cs,fyg/ yHk(442)/

yHk(442)

Packaging Report Dialog Box xyfraH y:vmrnf/ Save Report Command Button udka½G;cs,fyg/ yHk(443)/


Contents Microsoft Visual Basic 6.0

390

uuuGef

yHk(443)

Save Report Dialog Box xyfraH y:vmrnf/ Save in: List Box wGif vrfaMumif; ajymif;vdkygu ajymif;NyD; Text File udk odr;f Edik af yonf/ yH(k 444)/

yHk(444)

c:\My Documents\Package odv Yk rf;aMumif;ajymif;yg/ xdaYk emuf Save Command Button udka½G;cs,fyg/ yHk(445)/

yHk(445)

yHk(443)ygtwdkif; Dialog Box xyfrHay:vmrnf/ a½G;cs,fyg/ yHk(446)/ Close f g/ Command Button udak ½G;cs,y


Contents Microsoft Visual Basic 6.0

391

uuuGef

yHk(446)

yH(k 447)ygtwdik ;f Package and Deployment Wizard Dialog Box xyfraH y:vm rnf/ Close Command Button udak ½G;cs,yf g/ rlvy½d*k &rfoo Ykd mjyefa&mufomG ;rnf/

yHk(447)

Application Package tm; C:\My Documents\Package xJwi G v f rf;aMumif; ay;xm;ojzifh uGeyf sLwm Desktop ay:wGi½f adS eonfh Short Cut Icon wpfcjk zpfaom My Computer rS Munfy h gu yH(k 448)ygtwdik ;f jrifawGUEdik yf gonf/


Contents Microsoft Visual Basic 6.0

392

uuuGef

yHk(447)

tjcm;uGeyf sLwmpufwpfv;kH odYk Install jyKvyk v f ykd gu C:\My Documents\Package dS ikd t f m;vH;k udk ul;oGm;Ny;D Setup.exe udk Double Click ESyd &f rnfjzpfonf/ Folder atmuf½z Microsoft Visual Basic 6.0 rwyfqif&ao;aom uGey f sLwmrsm;wGiv f nf; Install vkyNf y;D ygu Run í&Edik af yonf/ ---------------0-0-0---------------


Contents Microsoft Visual Basic 6.0

393

uuuGef

tjcm;uGefysLwmrsm;odkY jyefvnf Install jyKvkyfjcif; yH(k 447)wGiaf wGUjrifae&aom zdik rf sm;udk Compact Disc (CD) jzifah omfvnf;aumif;? Diskette jzifah omfvnf;aumif;ul;,lí tjcm;uGey f sLwmpufwpfv;kH odYk Install jyKvyk Ef ikd f ayonf/ tqdyk gzdik rf sm;xJrS Setup.exe udk Double Click ESdyfyg/ yHk(448)ygtwdkif;jrif awGU&rnf/ OK Command Button udak ½G;cs,&f rnf/

yHk(448)

aemufxyf Dialog Box wpfckxyfrHay:vmrnf/ yHk(449)/ uGefysLwmyHkygaom Command Button tm;a½G;cs,y f gu C:\Program Files\Project1 xJwiG f Install jyK vkyrf nfjzpfNy;D tjcm;vrf;aMumif;ajymif;vJí Install vkyv f ykd gu Change Directory udak ½G;írdrEd pS o f uf&mvrf;aMumif;ajymif; Install jyKvyk Ef ikd af yonf/ xdaYk Mumifh uGeyf sLwm yHkygaom Command Button tm;a½G;cs,yf g/


Contents Microsoft Visual Basic 6.0

394

uuuGef

yHk(449) aemufxyf Dialog Box wpfcx k yfraH y:vmrnf/ yH(k 449)/ uGeyf sLwmyHyk gaom Command Button tm;a½G;cs,fygu C:\Program Files\Project1 xJwGif Install jyK vkyrf nfjzpfNy;D tjcm;vrf;aMumif;ajymif;vJí Install vkyv f ykd gu Change Directory udak ½G;írdrEd pS o f uf&mvrf;aMumif;ajymif; Install jyKvyk Ef ikd af yonf/ xdaYk Mumifh uGeyf sLwm yHkygaom Command Button tm;a½G;cs,fyg/ yHk(450)yg Dialog Box wpfcx k yfraH y: vmrnf/


Contents Microsoft Visual Basic 6.0

395

uuuGef

yHk(450) Continue Command Button udak ½G;cs,& f rnf/ y½d*k &rfrsm;tm; Install vkyNf y;D ygu yH(k 451)ygtwdik ;f atmifjrifpmG Ny;D qH;k aMumif; Message Box ay:vmygu OK udk Click

vky&f efjzpfygonf/

yHk(451)


Contents Microsoft Visual Basic 6.0

uuuGef

396

y½d*k &rfrsm;onf uGeyf sLwmxJwiG f C:\Program Files\Project1 vrf;aMumif;atmuf odaYk &muf½o dS mG ;onfukd My Computer Short Icon tqifq h ifu h akd ½G;cs,jf cif;jzifh jrifawGU Edkifayonf/ yHk(452)/

yHk(452)

tqdyk g extest111.exe zdkifudk Run ygu y½d*k &rftouf0ifrnfjzpfonf/ ---------------0-0-0--------------InputBox a&;xHk;jzifh Password jyKvkyfjcif; InputBox a&;xH;k jzifh Password jyKvy k &f eftwGuf yH(k 453)wGiaf zmfjyxm;onfh Form

zdik w f pfcu k w kd nfaqmufyg/

yHk(453)


Contents Microsoft Visual Basic 6.0

397

uuuGef

yHk(453)yg Form zdik w f iG f Label, Timer, Command Button wdjYk zifw h nfaqmuf xm;Ny;D vdt k yfaom Properties rsm;udjk yifqifí y½d*k &rfrsm;udak &;om;&ayrnf/ Label1 - Label Properties twGuf (Name) Label1 Alignment 2 - Center AutoSize False BackColor &H80000018& BackStyle 1 - Opaque BorderStyle 1 - Fixed Single ForeColor &H80000002& Command1 - Command Button Properties rSm (Name) - Command1 Caption - E&xit Font - MS Sans Serif, Regular, 8 Timer1 - Timer Properties rSm (Name) - Timer1 Enabled - True Index - Empty Interval - 100 Left - 3960 Tag - Empty Top - 1920 Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() Dim Pw, Pword a=1 Pw = "Naing"


Contents Microsoft Visual Basic 6.0

398

uuuGef

Do While a <= 3 Pword = InputBox("Type in your password", "Password") If Pword <> Pw Then MsgBox "Sorry, incorrect password" Else Exit Sub End If a=a+1 Loop End End Sub Timer1_Timer() twGuf Private Sub Timer1_Timer() Dim i As Integer Label1.BackColor = &H80000018 Label1.ForeColor = blue Label1.Caption = Now End Sub txufygy½d*k &rfukd Run ygu yH(k 454)ygtwdik ;f jzpfay:vmrnf/

yHk(454)

InputBox a&;xHk;jzifha&;xm;ojzifh yxrOD;pGm Password awmif;onfh Input Box ay:vmrnf/ rdrdrS Password udkrSefuefpGm½dkufESdyfEdkifygu wpfBudrfwnf;y½dk*&rf Run rnfjzpfonf/ Password (3)Bur d ½f u kd í f rSeu f efrrI ½Syd gu y½d*k &rfxrJ x S u G o f mG ;vdrhf rnf/ 3 Burd t f wGi;f Password wpfcgr[kww f pfcgrSeu f efr½I rdS o S m y½d*k &rf Run rnfjzpf onf/ yxrtBurd w f iG f naing [k½dkufESdyfNyD; Enter odrYk [kwf OK Command Button udak ½G;cs,yf guyH(k 455)ygtwdik ;f Message Box wpfcjk zifjh yrnfjzpfonf/ Enter odrYk [kwf OK Command Button udka½G;cs,fyg/


Contents Microsoft Visual Basic 6.0

uuuGef

399

yHk(455)

xdt k cg Input Box aemufwpfzefjyefay:vmygu Password trSeu f kd jznfph u G í f Enter (odr Yk [kw)f OK Command Button udak ½G;cs,&f rnf/ yH(k 456)/

yHk(456)

xdktcg y½dk*&rf Run vmrnfudk yHk(457)ygtwdkif;jrifawGUEdkifayonf/ y½dk*&rfrS xGuv f ykd gu Exit Command Button udak ½G;cs,&f rnf/

yHk(457)

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


Contents Microsoft Visual Basic 6.0

uuuGef

400

omrefa&;xHk;jzifh Password jyKvkyfjcif; omrefa&;xHk;jzifh Password jyKvyk &f eftwGuf yH(k 458)wGiaf zmfjyxm;onfh Form zdik w f pfcu k w kd nfaqmufyg/

yHk(458)

yH(k 458)yg Form zdik w f iG f Label, Text Box, Command Button wdjYk zifw h nfaqmuf xm;Ny;D vdt k yfaom Properties rsm;udjk yifqifí y½d*k &rfrsm;udak &;om;&ayrnf/ Label1 - Label Properties twGuf (Name) Label1 Alignment 0 - Left Justify AutoSize True BackColor &H8000000F& BackStyle 0 - Transparent BorderStyle 0 - None Caption Enter Password = = = > ForeColor &H80000012& Command1 - Command Button Properties rSm (Name) - Command1 Caption - &Run Font - MS Sans Serif, Regular, 8


Contents Microsoft Visual Basic 6.0

uuuGef

401

Run Command Button twGuf Private Sub Command1_Click() Dim Pw, Pword Pw = "Naing" Pword = Text1.Text If Pword <> Pw Then Label2.Caption = "Sorry, incorrect password" Else Form1.Hide Form2.Show End If End Sub Form Load twGuf Private Sub Form_Load() If Text1.PasswordChar = "" Then Text1.PasswordChar = "*" Else Text1.PasswordChar = "" End If End Sub Password rSeu f efr½I ydS guaemufxyf Form zdik w f pfcak y:vmap&eftwGuf xyfrH í Form zdik w f pfcw k nfaqmuf&rnf/ yH(k 459)/

yHk(459)


Contents Microsoft Visual Basic 6.0

402

uuuGef

yHk(459)yg Form zdkifwGif Text Box, Timer, Command Button wdkYjzifh wnfaqmufxm;Ny;D vdt k yfaom Properties rsm;udjk yifqifí y½d*k &rfrsm;udak &;om;&ay rnf/ Text1 - TextBox Properties twGuf (Name) Text1 Alignment 2 - Center AutoSize True BorderStyle 1 - Fixed Single Font MS Sans Serif, Regular, 14 Text Empty Text2 - TextBox Properties twGuf (Name) Text2 Alignment 2 - Center AutoSize True BorderStyle 1 - Fixed Single Font MS Sans Serif, Regular, 14 Text Empty Timer1 - Timer Properties rSm (Name) - Timer1 Enabled - True Index - Empty Interval - 100 Left - 960 Tag - Empty Top - 1800 Command1 - Command Button Properties rSm (Name) - Command1 Caption - E&xit Font - MS Sans Serif, Regular, 8


Contents Microsoft Visual Basic 6.0

uuuGef

403

Exit Command Button twGuf Private Sub Command1_Click() Unload Me End End Sub Form Load twGuf Private Sub Form_Load() Text1.Text = Time$ Text2.Text = Date$ End Sub Timer1_Timer() twGuf Private Sub Timer1_Timer() Text1.Text = Time$ End Sub

yHk(458)yg Form zdik u f kd Run ygu yH(k 460)ygtwdik ;f jzpfay:vmrnf/

yHk(460)

Text Box wGif rdrt d aejzifh jzpfEikd o f nfxifonfh pmom;ud½k u kd &f rnf/ Oyrm Maung [k½u kd yf g/ Text Box wGif Asterisk (*) rsm;omay:vmrnf/ Run Comf efr½I rdS o S m mand Button udak ½G;onfjzpfap? Alt+R udak ½G;onfjzpfap Password rSeu y½dk*&rf Run rnfjzpfonf/ Password rrSeu f efygu yH(k 461)ygtwdik ;f jyovdrrhf nf/


Contents Microsoft Visual Basic 6.0

uuuGef

404

yHk(461)

Password udr k eS u f efpmG ½du k rf xnfEh ikd yf gu y½d*k &rfxo J v Ykd ;kH 00ifciG jhf yKrnf r[kwb f J Password rSeu f efr½I rdS o S m aemuf Form wpfco k q Ykd ufvuftvkyv f yk rf nfjzpfygonf/ xdaYk Mumifh y½d*k &rfxw J iG o f wfrw S x f m;aom Password jzpfaom Naing udk jznfph u G Nf y;D Enter odr Yk [kwf OK Command Button udak ½G;cs,yf g/ yH(k 462)ygtwdik ;f jzpfay:vmrnf/ y½d*k &rfxrJ x S u G v f ykd gu Exit Command Button udak ½G;cs,yf g/

yHk(462)

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


Contents Microsoft Visual Basic 6.0

405

uuuGef

tcef;(12) Microsoft Internet Explore zdkifudkqJG,ltoHk;csjcif; yxrOD;pGm Microsoft Internet Explore wGif Run í&Edkifap&ef HTML (Hyper Text Mark-Up Language) jzifh y½dk*&rfrsm;udka&;om;&rnf/ Oyrm - c:\html_notes vrf;aMumif;xJwiG f rdrt d vd½k o dS nfh HTML zdik rf sm;a&;om;xm;&rnf/ k t f wGuf Index.htm zdi <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> k t f wGuf header.htm zdi <html> <head><title>Web Page Header</Title> <base target="contents"></head> <body> <p align="center"><b><big><big> <marquee align="middle" behavior="alternate" direction="right"> Welcome to My Home Page</marquee> </big></big></b></p> </body> </html> k t f wGuf content.htm zdi <html> <head><title> Content </Title> <base target="main"></head>


Contents Microsoft Visual Basic 6.0

406

uuuGef

<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>


Contents Microsoft Visual Basic 6.0

407

uuuGef

* <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> k t f wGuf main.htm zdi <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> k t f wGuf heading.htm zdi <html> <head><title>Heading Text Styles </Title></head> <body> <H1>Heading 1 </H1> <H2>Heading 2 </H2> <H3>Heading 3 </H3>


Contents Microsoft Visual Basic 6.0

408

<H4>Heading 4 </H4> <H5>Heading 5 </H5> <H6>Heading 6 </H6> <H7>Normal Size </H7> </body> </html> k t f wGuf hruler2.htm zdi <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> k t f wGuf format.htm zdi <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> 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> <Font Size=3> Font Size =3 </font><br>

uuuGef


Contents Microsoft Visual Basic 6.0

409

uuuGef

<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> 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> 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> </Font>


Contents Microsoft Visual Basic 6.0

410

uuuGef

</b> </body> </html> k t f wGuf bgsound.htm zdi <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> k t f wGuf BGColorCode.htm zdi <html> <head><title>Background Color Code</Title></head> <body BGCOLOR="#00ff00"> <h1>BGCOLOR is Green ... (Code)</h1> </body> </html> 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> X<sup>2</sup>+y-10</h3><br> <tt>This is a Monotype Text Style. This is a Monotype Text Style, This is a


Contents Microsoft Visual Basic 6.0

411

uuuGef

Monotype Text Style, This is a Monotype Text Style. </tt> </body> </html> k t f wGuf fontType.html zdi <html> <head><title>Font Type</Title></head> <body><pre> 1. Pre-formated 2. Pre-formated Pre-formated Pre-formated</pre> <acronym>Acronym Acronym Acronym </acronym><br> <address>Address Address Address </address><br> <blockquote>BlockQuote BlockQuote BlockQuote </blockquote><br> <cite>Cite Cite Cite </cite><br> <del>Del Del Del </del><br> <dfn>Defination Defination Defination </dfn><br> <em>Em Em Em </em><br> <ins>Insert Insert Insert </ins><br> <textarea cols=50 rows=10 name="area1"> This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area.This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. This is text area. </textarea> </body> </html> k t f wGuf format.htm zdi <html> <head><title>Text Formatting</Title></head>


Contents Microsoft Visual Basic 6.0

412

uuuGef

<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> k t f wGuf Paragraph.htm zdi <html> <head><title>Sparating Paragraphs</Title></head> <body><p> Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1</p> <p align="center"> Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 Paragraph1 </p> </body> </html>


Contents Microsoft Visual Basic 6.0

413

uuuGef

k t f wGuf Form_table1.htm zdi <HTML> <HEAD> <TITLE>JavaScript & Forms</TITLE> </HEAD> <BODY> <Center> <SCRIPT LANGUAGE="JavaScript"> <!-- begining of script function CalcTotals() { var p1_Float = parseFloat(document.Form1.Price1.value); var p2_Float = parseFloat(document.Form1.Price2.value); var p3_Float = parseFloat(document.Form1.Price3.value); var q1_Float = parseFloat(document.Form1.Quantity1.value); var q2_Float = parseFloat(document.Form1.Quantity2.value); var q3_Float = parseFloat(document.Form1.Quantity3.value); var Total = 0; document.Form1.SubTotal1.value = q1_Float*p1_Float; document.Form1.SubTotal2.value = q2_Float*p2_Float; document.Form1.SubTotal3.value = q3_Float*p3_Float; document.Form1.Total.value = (q1_Float*p1_Float)+(q2_Float*p2_Float)+ (q3_Float*p3_Float);} <!-- end of script --></SCRIPT> <FORM NAME="Form1"> <TABLE WIDTH="600"> <TR> <TH VALIGN="TOP" ALIGN="CENTER">No.</TH> <TH VALIGN="TOP" ALIGN="CENTER">Rank</TH> <TH VALIGN="TOP" ALIGN="CENTER">Pay </TH> <TH VALIGN="TOP" ALIGN="CENTER">Amount of Soldier</TH> <TH VALIGN="TOP" ALIGN="CENTER">Total Pay</TH>


Contents Microsoft Visual Basic 6.0

414

uuuGef

</TR> <TR> <TD VALIGN="TOP" ALIGN="CENTER">1.</TD> <TD VALIGN="TOP" ALIGN="CENTER">Sgt</TD> <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>


Contents Microsoft Visual Basic 6.0

415

uuuGef

<TR> <TD VALIGN="TOP" ALIGN="CENTER" COLSPAN="5"><HR></TD> </TR> <TR> <TD VALIGN="TOP" ALIGN="CENTER"></TD> <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> 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">


Contents Microsoft Visual Basic 6.0

416

uuuGef

<img src="./Images/222.jpg" Height=300 width=175 alt="222.gif"><br> </center> </body> </html> k t f wGuf ImageTable.htm zdi <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>


Contents Microsoft Visual Basic 6.0

417

uuuGef

<b> <Font color=red size=6 face="NuptialScript"> Image Table </Font> </ b> </Center> </body> </html> 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>


Contents Microsoft Visual Basic 6.0

418

uuuGef

</html> Video.htm zdkiftwGuf <html> <head><title>Video is playing (Another Directory)</Title></head> <body> <center> <img dynsrc="c:\my documents\Music12.dat"> <h1>Video is playing ... </h1> </center> </html> VBScript.htm zdkiftwGuf <HTML> <HEAD> <TITLE>VBScript & Form Example</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <SCRIPT LANGUAGE="VBScript"> <!-- begining of script Sub add_2_num() a_str = document.Form1.Text1.value b_str = document.Form1.Text2.value a_int = cint(a_str) b_int = cint(b_str) c=0 c = a_int+b_int MsgBox "The answer is: " & c End Sub <!-- end of script --></SCRIPT> <FORM NAME="Form1"> <P>A=<INPUT TYPE="TEXT" NAME="Text1"><BR>


Contents Microsoft Visual Basic 6.0

419

uuuGef

B = <INPUT TYPE = "TEXT" NAME = "Text2"><BR> <INPUT TYPE = "BUTTON" NAME = "Button1" VALUE = "A+B=" ONCLICK = "add_2_num()"></p> </FORM> </BODY> </HTML> 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>


Contents Microsoft Visual Basic 6.0

420

</FORM> </BODY> </HTML> k t f wGuf HTML_Option.htm zdi <HTML><HEAD><TITLE>MyPage</TITLE></head> <BODY BGCOLOR=FFFFFF TEXT=000000> <CENTER> <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>

uuuGef


Contents Microsoft Visual Basic 6.0

421

uuuGef

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> 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>


Contents Microsoft Visual Basic 6.0

422

uuuGef

<H2><font color="blue">Enter Fahrenheit Degree            &nbsp <INPUT TYPE="TEXT" NAME="P1"><br> Equivalent Centigrade Degree&nbsp<INPUT TYPE="TEXT" NAME="cen"><br><br> <INPUT TYPE="BUTTON" NAME="Button1" VALUE="Run" ONCLICK="CTs()"></font></H2><br> </FORM> </center> </BODY> </HTML> Java_TextTyper.htm zdkiftwGuf <HTML LANG="en"> <HEAD><title>TextTyper v2.5</title> <META http-equiv="Content-Type" content="text/html; harset=iso-8859-1"> <LINK REL="email" HREF="mailto:agent_teg@ThePentagon.com"> <style type="text/css"> <!-B { font-weight: bold } #ttl0 { position: absolute } .ttl1 { font: 8pt Verdana, Arial, Helvetica, serif } // --> </style> <script type="text/javascript" language="javascript"> <!-/* */ var layers = document.layers, style = document.all, both = layers || style, idme=908601;


Contents Microsoft Visual Basic 6.0

423

uuuGef

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>"); 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); }


Contents Microsoft Visual Basic 6.0

424

uuuGef

} 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); } // --> </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-BF0100AA0055595A" 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">


Contents Microsoft Visual Basic 6.0

425

uuuGef

<embed src="type.au" width="37" height="0" controls="playbutton" hidden="true" autostart="false" alt=""> </OBJECT> --> </BODY> </HTML> 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 ="#0000FF" SIZE="+1"><span style="background-color: #00FF00">Activate your mouse on the center area.</span></font></B></P> </BLOCKQUOTE> <P><CENTER><B><FONT SIZE="+1"> <APPLET WIDTH="190" HEIGHT="190" ALIGN="BOTTOM" CODE="WaterApp.class" CODEBASE="./"> <PARAM NAME="dim" VALUE="6"> <PARAM NAME="dotsize" VALUE="6"> <PARAM NAME="logoheight" VALUE="200"> <PARAM NAME="image" VALUE="Images/fxlogo.gif"> <PARAM NAME="mouse" VALUE="1"> <PARAM NAME="noise" VALUE="0"> <PARAM NAME="col1" VALUE="ffff34"> <PARAM NAME="col2" VALUE="ff3434">


Contents Microsoft Visual Basic 6.0

426

uuuGef

<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> k t f wGuf Bump.html zdi <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"> <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">


Contents Microsoft Visual Basic 6.0

427

uuuGef

<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> k t f wGuf Bump2.html zdi <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"> <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="./">


Contents Microsoft Visual Basic 6.0

428

uuuGef

<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> k t f wGuf Bump3.html zdi <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"> <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>


Contents Microsoft Visual Basic 6.0

429

uuuGef

<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> Lens.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>


Contents Microsoft Visual Basic 6.0

430

uuuGef

</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> Lens2.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>


Contents Microsoft Visual Basic 6.0

431

uuuGef

<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> 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>


Contents Microsoft Visual Basic 6.0

uuuGef

432

<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>

txufyg HTML zdkifrsm;tm; y½dk*&rfjzifhqJGwif&eftwGuf Form zdkifwpfckudk wnfaqmuf&rnf/

yHk(463)

yHk(463)yg Form zdkifwGif Timer, Label, Progress Bar wdjYk zifh wnfaqmufxm;Ny;D vdt k yfaom Properties rsm;udjk yifqifí y½d*k &rfrsm;udak &;om;&ayrnf/ Timer1 - Timer Properties rSm (Name) Enabled

-

Timer1 True


Contents Microsoft Visual Basic 6.0

433

uuuGef

Index - Empty Interval - 5000 Left - 3480 Tag - Empty Top - 0 Label1 - Label Properties rSm (Name) - Label1 Alignment - 2 - Center AutoSize - False BackStyle - 1 - Opaque BorderStyle - 1 - Fixed Single Caption - uGefysLwmXme (uGefysLwmXme) Font - -Win---Taungyi, Bold, 36 ProgressBar1 - ProgressBar Properties rSm (Name) - ProgressBar1 Align - 0 - vbAlignNone Max - 1000 Min - 0 Font - MS Sans Serif, Regular, 8 Timer1 Timer() twGuf Private Sub Timer1_Timer() Private Sub Timer1_Timer() Dim n1 As Integer For n1 = 1 To 1000 Form1.Caption = "Processing Step " & Trim$(CStr(n1)) & " of 1000" ProgressBar1 = n1 Next n1 Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE c:\html_notes\index.htm", 1) End End Sub


Contents Microsoft Visual Basic 6.0

434

uuuGef

yHk(463)yg Form zdik u f kd Run ygu yH(k 464)ygtwdik ;f jzpfay:vmrnf/

yHk(464)

acwåcP(Oyrm - 5 puúecYf efMY umjrifyh gu yH(k 465)ygtwdik ;f y½d*k &rf Run rnf jzpfonf/ Time Interval tm; 5000 ay;xm;aomaMumifjh zpfonf/

yHk(465)

Progress Bar wef;jynfo h mG ;ygu yH(k 466)ygtwdik ;f Microsoft Internet Exk &rfrsm;udk toH;k csí&NyjD zpfonf/ plore ay:vmNyD; HTML jzifah &;om;xm;onfh y½d* tu,fí Microsoft Internet Explore rSxu G v f ykd gu Close Button udEk ydS &f rnf/


Contents Microsoft Visual Basic 6.0

435

yHk(466) ---------------0-0-0---------------

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

436

tcef;(13) Application Package rsm;udky½dk*&rfjzifhzGifhjcif; Microsoft Visual Basic 6.0 jzifh Application Package rsm;udq k w GJ ifvykd gu atmufygtwdik ;f Form wpfcu k w kd nfaqmuf&rnf/ yH(k 467)/

yHk(467)

Form1 - Form Properties (Name) Form1 BorderStyle 2 - Sizable Caption Openning of the Application Package Font MS Sans Serif, Regular, 8 WindowState 0 - Normal Command1 - Command Button Properties (Name) Command1 Caption Open Microsoft &Word Font MS Sans Serif, Regular, 8 Command2 - Command Button Properties (Name) Command2 Caption Open Microsoft &Excel Font MS Sans Serif, Regular, 8


Contents Microsoft Visual Basic 6.0

437

uuuGef

Command3 - Command Button Properties (Name) Command3 Caption Open Microsoft &Access Font MS Sans Serif, Regular, 8 Command4 - Command Button Properties (Name) Command4 Caption Open Adobe &Page Maker 6.5 Font MS Sans Serif, Regular, 8 Command5 - Command Button Properties (Name) Command5 Caption E&xit Font MS Sans Serif, Regular, 8 Command1 - Command Button twGuf Private Sub Command1_Click() Dim MyAppID MyAppID = Shell("C:\Program Files\Microsoft Office\Office10\ WINWORD.EXE", 1) End Sub Command2 - Command Button twGuf Private Sub Command2_Click() Dim MyAppID MyAppID = Shell("C:\Program Files\Microsoft Office\Office10\ EXCEL.EXE", 1) End Sub Command3 - Command Button twGuf Private Sub Command3_Click() Dim MyAppID MyAppID = Shell("C:\Program Files\Microsoft Office\Office10\ MSACCESS.EXE", 1) End Sub Command4 - Command Button twGuf Private Sub Command4_Click() Dim MyAppID MyAppID = Shell("C:\PM65\PM65.EXE", 1) End Sub


Contents Microsoft Visual Basic 6.0

438

Command5 - Command Button twGuf Private Sub Command5_Click() Unload Me End End Sub ---------------0-0-0---------------

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

439

tcef;(14) taxGaxG Multiple List Box rsm;zefwD;jcif; atmufygtwdik ;f Form wpfcu k w kd nfaqmuf&rnf/ yH(k 468)/ 4if;wGif Label, Text h efw;D xm;Ny;D oufqikd &f m Properties rsm;udjk yifqif Box, Command Button wdjYk zifz jznfph u G Nf y;D aemuf Command Button rsm;wGif atmufygy½d*k &rfrsm;udak &;om;&rnf/

yHk(468)

Lable1 Properties twGuf (Name) Label1 AutoSize True BackStype 0 - Transparent Caption How many number? Lable2 Properties twGuf (Name) Label2 AutoSize True BackStype 0 - Transparent Caption Enter each number = >


Contents Microsoft Visual Basic 6.0

440

Text1 Text Box Properties twGuf (Name) Text1 Alignment 0 - Left Justified Index Empty Locked False Text Empty Text2 Text Box Properties twGuf (Name) Text Alignment 0 - Left Justified Index 1 Locked False Text Empty Command1 Command Button Properties twGuf (Name) Command1 Caption &Add (Text Box) Enabled True Command2 Command Button Properties twGuf (Name) Command2 Caption E&xit Enabled True Form1 Form Properties twGuf (Name) Form1 Enabled True Caption Example Multiple Text Box Object: General, Proc: [Declaration] twGuf Dim a1, a2 As Integer Add (Text Box) - Command1 Button twGuf Private Sub Command1_Click() a2 = Val(Text1) If a1 = 0 Then a1 = 1 If a1 > a2 Then Exit Sub a1 = a1 + 1 Text1.Locked = True

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

441

Load Text(a1) b1 = Text(a1).Name 'Text(a1).Name="Text" b2 = Text(a1).Index 'Text(a1).Index = a1+1 b1 = "Text" b2 = a1 + 1 Text(a1).Locked = True Text(a1).Top = Text(a1 - 1).Top + 400 Text(a1).Left = Text(a1).Left - 400 Text(a1).Visible = True Print Text(a1), Text(a1).Name, Text(a1).Index Text(a1) = Text(a1) End Sub Exit - Command2 Button twGuf Private Sub Command2_Click() Unload Me 'Unload this form End End Sub

txufyg y½d*k &rfukd Run ygu yH(k 469)ygtwdik ;f jrifawGU&rnfjzpfygonf/

yHk(469)

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


Contents Microsoft Visual Basic 6.0

442

uuuGef

Exchange Sort udk Visual Basic jzifha&;om;jcif; atmufygtwdik ;f Form wpfcu k w kd nfaqmuf&rnf/ yH(k 470)/ 4if;wGif Label, Text h efw;D xm;Ny;D oufqikd &f m Properties rsm;udjk yifqif Box, Command Button wdjYk zifz jznfph u G Nf y;D aemuf Command Button rsm;wGif atmufygy½d*k &rfrsm;udak &;om;&rnf/

yHk(470)

Lable1 Properties twGuf (Name) Label1 AutoSize True BackStype 0 - Transparent Caption How many number? Lable2 Properties twGuf (Name) Label2 AutoSize True BackStype 0 - Transparent Caption Enter each number = >


Contents Microsoft Visual Basic 6.0

443

Text1 Text Box Properties twGuf (Name) Text1 Alignment 0 - Left Justified Index Empty Locked False Text Empty Text2 Text Box Properties twGuf (Name) Text Alignment 0 - Left Justified Index 1 Locked False Text Empty Command1 Command Button Properties twGuf (Name) Command1 Caption &Add (Text Box) Enabled True Command2 Command Button Properties twGuf (Name) Command2 Caption &Exchange Sort Enabled True Command3 Command Button Properties twGuf (Name) Command3 Caption E&xit Enabled True Form1 Form Properties twGuf (Name) Form1 Enabled True Caption Exchange Sort (Ascending Order) Object: General, Proc: [Declaration] twGuf Dim num1, n, k(50) As Integer Add (Text Box) - Command1 Button twGuf Private Sub Command1_Click() n = Val(Text1)

uuuGef


Contents Microsoft Visual Basic 6.0

444

uuuGef

Text1.Locked = True If num1 = 0 Then num1 = 1 If num1 > n Then Exit Sub num1 = num1 + 1 Load Text(num1) b1 = Text(num1).Name 'Text(num1).Name="Text" b2 = Text(num1).Index 'Text(num1).Index = num1+1 Text(num1).Locked = True Text(num1).Top = Text(num1 - 1).Top + 400 Text(num1).Left = Text(num1).Left - 400 Text(num1).Visible = True Print Text(num1), Text(num1).Name, Text(num1).Index i = Text(num1).Index - 1 k(i) = Text(num1) Print k(i), i End Sub Exchange Sort - Command2 Button twGuf Private Sub Command2_Click() Cls For i = 1 To n - 1 For j = 1 To n - 1 If k(j) <= k(j + 1) Then GoTo 100 t = k(j): k(j) = k(j + 1): k(j + 1) = t 100 Next j Next i For x = 1 To n Print k(x) Next End Sub Exit - Command3 Button twGuf Private Sub Command3_Click() Unload Me End End Sub txufyg y½d*k &rfukd Run ygu yH(k 471)ygtwdik ;f jrifawGU&rnfjzpfygonf/


Contents Microsoft Visual Basic 6.0

uuuGef

445

yHk(471)

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


Contents Microsoft Visual Basic 6.0

446

uuuGef

Counting Sort udk Visual Basic jzifha&;om;jcif; atmufygtwdik ;f Form wpfcu k w kd nfaqmuf&rnf/ yH(k 472)/ 4if;wGif Label, Text h efw;D xm;Ny;D oufqikd &f m Properties rsm;udjk yifqif Box, Command Button wdjYk zifz jznfph u G Nf y;D aemuf Command Button rsm;wGif atmufygy½d*k &rfrsm;udak &;om;&rnf/

yHk(472)

Lable1 Properties twGuf (Name) Label1 AutoSize True BackStype 0 - Transparent Caption How many number? Lable2 Properties twGuf (Name) Label2 AutoSize True BackStype 0 - Transparent Caption Enter each number = >


Contents Microsoft Visual Basic 6.0

447

Text1 Text Box Properties twGuf (Name) Text1 Alignment 0 - Left Justified Index Empty Locked False Text Empty Text2 Text Box Properties twGuf (Name) Text Alignment 0 - Left Justified Index 1 Locked False Text Empty Command1 Command Button Properties twGuf (Name) Command1 Caption &Add (Text Box) Enabled True Command2 Command Button Properties twGuf (Name) Command2 Caption &Counting Sort Enabled True Command3 Command Button Properties twGuf (Name) Command3 Caption E&xit Enabled True Form1 Form Properties twGuf (Name) Form1 Enabled True Caption Counting Sort (Ascending Order) Object: General, Proc: [Declaration] twGuf Dim num1, n, k(50), f(50), kount(50) As Integer Add (Text Box) - Command1 Button twGuf Private Sub Command1_Click() n = Val(Text1) Text1.Locked = True

uuuGef


Contents Microsoft Visual Basic 6.0

448

If num1 = 0 Then num1 = 1 If num1 > n Then Exit Sub num1 = num1 + 1 Load Text(num1) b1 = Text(num1).Name 'Text(num1).Name="Text" b2 = Text(num1).Index 'Text(num1).Index = num1+1 Text(num1).Locked = True Text(num1).Top = Text(num1 - 1).Top + 400 Text(num1).Left = Text(num1).Left - 400 Text(num1).Visible = True Print Text(num1), Text(num1).Name, Text(num1).Index i = Text(num1).Index - 1 k(i) = Text(num1) Print k(i), i Text(num1) = Text(num1) End Sub Counting Sort - Command2 Button twGuf Private Sub Command2_Click() Cls For i = 1 To n kount(i) = 1 Next For i = 2 To n For j = 1 To i - 1 If k(i) > k(j) Then kount(i) = kount(i) + 1 Else kount(j) = kount(j) + 1 End If Next j Next i For i = 1 To n f(kount(i)) = k(i) Next

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

449

For x = 1 To n Print f(x) Next End Sub Exit - Command3 Button twGuf Private Sub Command3_Click() Unload Me End End Sub txufyg y½d*k &rfukd Run ygu yH(k 473)ygtwdik ;f jrifawGU&rnfjzpfygonf/

yHk(473)

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


Contents Microsoft Visual Basic 6.0

450

uuuGef

Insertion Sort udk Visual Basic jzifha&;om;jcif; atmufygtwdik ;f Form wpfcu k w kd nfaqmuf&rnf/ yH(k 474)/ 4if;wGif Label, Text h efw;D xm;Ny;D oufqikd &f m Properties rsm;udjk yifqif Box, Command Button wdjYk zifz jznfph u G Nf y;D aemuf Command Button rsm;wGif atmufygy½d*k &rfrsm;udak &;om;&rnf/

yHk(474)

Lable1 Properties twGuf (Name) Label1 AutoSize True BackStype 0 - Transparent Caption How many number? Lable2 Properties twGuf (Name) Label2 AutoSize True BackStype 0 - Transparent Caption Enter each number = >


Contents Microsoft Visual Basic 6.0

451

Text1 Text Box Properties twGuf (Name) Text1 Alignment 0 - Left Justified Index Empty Locked False Text Empty Text2 Text Box Properties twGuf (Name) Text Alignment 0 - Left Justified Index 1 Locked False Text Empty Command1 Command Button Properties twGuf (Name) Command1 Caption &Add (Text Box) Enabled True Command2 Command Button Properties twGuf (Name) Command2 Caption &Insertion Sort Enabled True Command3 Command Button Properties twGuf (Name) Command3 Caption E&xit Enabled True Form1 Form Properties twGuf (Name) Form1 Enabled True Caption Counting Sort (Ascending Order) Object: General, Proc: [Declaration] twGuf Dim num1, n, k(50) As Integer

uuuGef


Contents Microsoft Visual Basic 6.0

452

Add (Text Box) - Command1 Button twGuf Private Sub Command1_Click() n = Val(Text1) Text1.Locked = True If num1 = 0 Then num1 = 1 If num1 > n Then Exit Sub num1 = num1 + 1 Load Text(num1) b1 = Text(num1).Name 'Text(num1).Name="Text" b2 = Text(num1).Index 'Text(num1).Index = num1+1 Text(num1).Locked = True Text(num1).Top = Text(num1 - 1).Top + 400 Text(num1).Left = Text(num1).Left - 400 Text(num1).Visible = True Print Text(num1), Text(num1).Name, Text(num1).Index i = Text(num1).Index - 1 k(i) = Text(num1) Print k(i), i Text(num1) = Text(num1) End Sub Insertion Sort - Command2 Button twGuf Private Sub Command2_Click() Cls For i = 2 To n current = k(i) j=i-1 70 If j < 1 Or current >= k(j) Then GoTo 100 k(j + 1) = k(j) j=j-1 GoTo 70 100 k(j + 1) = current Next i

uuuGef


Contents Microsoft Visual Basic 6.0

453

uuuGef

Do While j >= 1 And current < k(j) k(j + 1) = k(j) j=j-1 Loop For x = 1 To n Print k(x) Next End Sub Exit - Command3 Button twGuf Private Sub Command3_Click() Unload Me End End Sub txufyg y½d*k &rfukd Run ygu yH(k 475)ygtwdik ;f jrifawGU&rnfjzpfygonf/

yHk(475)

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


Contents Microsoft Visual Basic 6.0

454

uuuGef

Selection Sort with Exchange udk Visual Basic jzifha&;om;jcif; atmufygtwdik ;f Form wpfcu k w kd nfaqmuf&rnf/ yH(k 476)/ 4if;wGif Label, Text h efw;D xm;Ny;D oufqikd &f m Properties rsm;udjk yifqif Box, Command Button wdjYk zifz jznfph u G Nf y;D aemuf Command Button rsm;wGif atmufygy½d*k &rfrsm;udak &;om;&rnf/

yHk(476)

Lable1 Properties twGuf (Name) Label1 AutoSize True BackStype 0 - Transparent Caption How many number? Lable2 Properties twGuf (Name) Label2 AutoSize True BackStype 0 - Transparent Caption Enter each number = >


Contents Microsoft Visual Basic 6.0

455

uuuGef

Text1 Text Box Properties twGuf (Name) Text1 Alignment 0 - Left Justified Index Empty Locked False Text Empty Text2 Text Box Properties twGuf (Name) Text Alignment 0 - Left Justified Index 1 Locked False Text Empty Command1 Command Button Properties twGuf (Name) Command1 Caption &Add (Text Box) Enabled True Command2 Command Button Properties twGuf (Name) Command2 Caption &Selection Sort with Exchange Enabled True Command3 Command Button Properties twGuf (Name) Command3 Caption E&xit Enabled True Form1 Form Properties twGuf (Name) Form1 Enabled True Caption Selection Sort with Exchange (Ascending Order) Object: General, Proc: [Declaration] twGuf Dim num1, n, k(50) As Integer


Contents Microsoft Visual Basic 6.0

456

Add (Text Box) - Command1 Button twGuf Private Sub Command1_Click() n = Val(Text1) Text1.Locked = True If num1 = 0 Then num1 = 1 If num1 > n Then Exit Sub num1 = num1 + 1 Load Text(num1) b1 = Text(num1).Name 'Text(num1).Name="Text" b2 = Text(num1).Index 'Text(num1).Index = num1+1 Text(num1).Locked = True Text(num1).Top = Text(num1 - 1).Top + 400 Text(num1).Left = Text(num1).Left - 400 Text(num1).Visible = True Print Text(num1), Text(num1).Name, Text(num1).Index i = Text(num1).Index - 1 k(i) = Text(num1) Print k(i), i Text(num1) = Text(num1) End Sub Selection Sort with Exchange - Command2 Button twGuf Private Sub Command2_Click() Cls For i = 1 To n - 1 mini = k(i): idx = i For j = i + 1 To n If k(j) >= mini Then GoTo 10 mini = k(j): idx = j 10 Next j k(idx) = k(i): k(i) = mini Next i For i = 1 To n Print k(i) Next

uuuGef


Contents Microsoft Visual Basic 6.0

uuuGef

457

For i = 1 To n Print k(i) Next End Sub Exit - Command3 Button twGuf Private Sub Command3_Click() Unload Me End End Sub txufyg y½d*k &rfukd Run ygu yH(k 477)ygtwdik ;f jrifawGU&rnfjzpfygonf/

yHk(477)

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


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.