Anda di halaman 1dari 38

Computer Applications-II

LAB-1 Working with Command Buttons


Private Sub Command1_Click() If Text1.FontBold = True Then Text1.FontBold = False Else Text1.FontBold = True End If End Sub Private Sub Command2_Click() If Text1.FontItalic = True Then Text1.FontItalic = False Else Text1.FontItalic = True End If End Sub Private Sub Command3_Click() If Text1.FontUnderline = True Then Text1.FontUnderline = False Else Text1.FontUnderline = True End If End Sub Private Sub Form_ oad() Text1.Text = Clear End Sub

Computer Applications-II

LAB-2 Working with Option Buttons


Private Sub Form_ oad() Text1.Text = Clear End Sub Private Sub !ption1_Click() If Option1. alue = True Then Text1.FontBold = True Text1.FontItalic = False Text1.FontUnderline = False End If End Sub Private Sub !ption2_Click() If Option2. alue = True Then Text1.FontBold = False Text1.FontItalic = True Text1.FontUnderline = False End If End Sub Private Sub !ption3_Click() If Option!. alue = True Then Text1.FontBold = False Text1.FontItalic = False Text1.FontUnderline = True End If End Sub

Computer Applications-II

LAB-3 Working with Check Boxes


Private Sub C"eck1_Click() If Chec"1. alue = 1 Then Text1.FontBold = True Else Text1.FontBold = False End If End Sub Private Sub C"eck2_Click() If Chec"2. alue = 1 Then Text1.FontItalic = True Else Text1.FontItalic = False End If End Sub Private Sub C"eck3_Click() If Chec"!. alue = 1 Then Text1.FontUnderline = True Else Text1.FontUnderline = False End If End Sub Private Sub Form_ oad() Text1.Text = Clear End Sub

Computer Applications-II

LAB-4 Working with Combo Box


Private Sub Command1_Click() Co$bo1.%ddIte$ Text1.Text Text1.Text = Clear Text1.SetFocus End Sub Private Sub Form_ oad() Text1.Text = Clear End Sub Private Sub #e$t1_%e&Press(%e&Ascii As Inte'er) If &e'%scii = 1! Then Co$bo1.%ddIte$ Text1.Text Text1.Text = Clear Text1.SetFocus End If End Sub

Computer Applications-II

LAB-

Working with List Box

Private Sub Command1_Click() )ist1.%ddIte$ Text1.Text Text1.Text = Clear Text1.SetFocus End Sub Private Sub Form_ oad() Text1.Text = Clear End Sub Private Sub #e$t1_%e&Press(%e&Ascii As Inte'er) If &e'%scii = 1! Then )ist1.%ddIte$ Text1.Text Text1.Text = Clear Text1.SetFocus End If End Sub

Computer Applications-II

LAB-! Working with Command Buttons " List Box


Private Sub Command1_Click() )ist1.%ddIte$ Text1.Text Text1.Text = Clear Text1.SetFocus End Sub Private Sub Command2_Click() +s,Box )ist1.)istCount End Sub Private Sub Command3_Click() )ist1.Clear End Sub Private Sub Form_ oad() Text1.Text = Clear End Sub Private Sub #e$t1_%e&Press(%e&Ascii As Inte'er) If &e'%scii = 1! Then )ist1.%ddIte$ Text1.Text Text1.Text = Clear Text1.SetFocus End If End Sub

Computer Applications-II

LAB-# Working with $e%Ascii and &et'ocus


Private Sub Command1_Click() r = +s,Box./%re 0ou Sure/1 2b0es3o 4 2bInfor$ation5 If r = 2b0es Then End Else +s,Box /Than" 0ou/ End If End Sub Private Sub Form_ oad() Text1.Text = Clear Text2.Text = Clear Text!.Text = Clear End Sub Private Sub #e$t1_%e&Press(%e&Ascii As Inte'er) If &e'%scii = 1! Then Text1.Text = UCase.Text1.Text5 Text1.ForeColor = 2bBlue Text1.FontBold = True Text2.SetFocus End If End Sub Private Sub #e$t2_%e&Press(%e&Ascii As Inte'er) If &e'%scii = 1! Then Text!.SetFocus End If End Sub Private Sub #imer1_#imer() )abel#.ForeColor = 6BColor.7nd 8 1(5 End Sub

Computer Applications-II

LAB-(a Working with &cro)) Bars


Private Sub Form_ oad() Text1.Text = Clear :Scroll1.+in = ; Scroll1.+in = ; :Scroll1.+ax = #; Scroll1.+ax = #; End Sub Private Sub (Scroll1_C"an'e() Text1.ForeColor = 6BColor.7nd 8 1(5 End Sub Private Sub #e$t1_C"an'e() Text1.Font3a$e = /arial blac"/ Text1.FontSi<e = 12 End Sub Private Sub )Scroll1_C"an'e() Text1.Bac"Color = 6BColor.7nd 8 1(5 End Sub

Computer Applications-II

LAB-(b Working with &cro)) Bars


Private Sub Form_ oad() :Scroll1.+in = ; Scroll1.+in = ; :Scroll1.+ax = #; Scroll1.+ax = #; :Scroll1.)ar,eChan,e = ( Scroll1.)ar,eChan,e = ( :Scroll1.S$allChan,e = 1 Scroll1.S$allChan,e = 1 End Sub Private Sub (Scroll1_C"an'e() )abel1.Caption = :Scroll1. alue End Sub Private Sub )Scroll1_C"an'e() )abel2.Caption = Scroll1. alue End Sub

1;

Computer Applications-II

LAB-*a Creating +ark &heet


Private Sub Form_ oad()
Text1.Text = Clear Text2.Text = Clear Text!.Text = Clear Text#.Text = Clear Text(.Text = Clear Text*.Text = Clear Text-.Text = Clear Text9.Text = Clear Text=.Text = Clear End Sub

Private Sub #e$t*_%e&Press(%e&Ascii As Inte'er)


If &e'%scii = 1! Then Text-.Text = al.Text#.Text5 4 al.Text(.Text5 4 al.Text*.Text5 Text9.Text = al.Text-.Text > !;; 8 1;;5 If Text9.Text ? (; Then Text=.Text = /F/ End If If Text9.Text @= (; %nd Text9.Text ? *; Then Text=.Text = /C/ End If If Text9.Text @= *; %nd Text9.Text ? -; Then Text=.Text = /B/ End If If Text9.Text @= -; %nd Text9.Text ? 9; Then Text=.Text = /%/ End If If Text9.Text @= 9; Then Text=.Text = /%1/ End If End If End Sub

11

Computer Applications-II

LAB-*b Creating +ark &heet with procedure


Private Sub Form_ oad()
Text1.Text = Clear Text2.Text = Clear Text!.Text = Clear Text#.Text = Clear Text(.Text = Clear Text*.Text = Clear Text-.Text = Clear Text9.Text = Clear Text=.Text = Clear

End Sub Private Sub #e$t*_%e&Press(%e&Ascii As Inte'er)


If &e'%scii = 1! Then C%)C End If

End Sub Sub CA C()


Text-.Text = al.Text#.Text5 4 al.Text(.Text5 4 al.Text*.Text5 Text9.Text = al.Text-.Text > !;; 8 1;;5 If Text9.Text ? (; Then Text=.Text = /F/ End If If Text9.Text @= (; %nd Text9.Text ? *; Then Text=.Text = /C/ End If If Text9.Text @= *; %nd Text9.Text ? -; Then Text=.Text = /B/ End If If Text9.Text @= -; %nd Text9.Text ? 9; Then Text=.Text = /%/ End If If Text9.Text @= 9; Then Text=.Text = /%1/ End If

End Sub Private Sub #e$t*_ ostFocus() C%)C End Sub 12

Computer Applications-II

LAB-1, 'or--ext Loop


Private Sub Command1_Click() For % = 1 To 1; Arint % 3ext End Sub Private Sub Command2_Click() For % = 2 To 2; Step 2 Arint % 3ext End Sub Private Sub Command3_Click() For % = 1 To 1= Step 2 Arint % 3ext End Sub Private Sub Command+_Click() For % = 1 To 1; Arint 2B /8/B %B /=/B 2 8 % 3ext End Sub Private Sub Command,_Click() T = InputBox./E3TE7 %30 3U+BE7/5 For % = 1 To 1; Arint TB /8/B %B /=/B % 8 T 3ext End Sub Private Sub Command*_Click() For$1.Cls End Sub

1!

Computer Applications-II

LAB-11 Whi)e-Wend Loop


Private Sub Command1_Click()
%=; Chile % ? 1; %=%41 Arint % Cend

End Sub Private Sub Command2_Click()


%=; Chile % ? 2; %=%42 Arint % Cend

End Sub Private Sub Command3_Click()


% = D1 Chile % ? 1= %=%42 Arint % Cend

End Sub Private Sub Command+_Click()


%=; Chile % ? 1; %=%41 Arint 2B /8/B %B /=/B 2 8 % Cend

End Sub Private Sub Command,_Click()


T = InputBox./E3TE7 %30 3U+BE7/5 %=; Chile % ? 1; %=%41 Arint TB /8/B %B /=/B % 8 T Cend

End Sub Private Sub Command*_Click() For$1.Cls End Sub

1#

Computer Applications-II

LAB-12 .o-Whi)e Loop


Private Sub Command1_Click()
%=; Eo Chile % ? 1; %=%41 Arint % )oop

End Sub Private Sub Command2_Click()


%=; Eo Chile % ? 2; %=%42 Arint % )oop

End Sub Private Sub Command3_Click()


% = D1 Eo Chile % ? 1= %=%42 Arint % )oop

End Sub Private Sub Command+_Click()


%=; Eo Chile % ? 1; %=%41 Arint 2B /8/B %B /=/B 2 8 % )oop

End Sub Private Sub Command,_Click()


T = InputBox./E3TE7 %30 3U+BE7/5 %=; Eo Chile % ? 1; %=%41 Arint TB /8/B %B /=/B % 8 T )oop

End Sub Private Sub Command*_Click() For$1.Cls End Sub

1(

Computer Applications-II

LAB-13 /ser Authentication 'orm


Private Sub Command1_Click() If Text1.Text = /2isual/ Or Text1.Text = / ISU%)/ Then If Text2.Text = /basic/ Or Text2.Text = /B%SIC/ Then +s,Box /)OFO3 SUCCESSFU))0/ Else +s,Box /I3 %)IE A%SSCO7E/ End If Else +s,Box /I3 %)IE USE73%+E/ End If End Sub Private Sub Form_ oad() Text1.Text = Clear Text2.Text = Clear End Sub

1*

Computer Applications-II

LAB-14 Creating a &ma)) -otepad


Private Sub Combo1_Click() Select Case .Co$bo1.Text5 Case /B)%C&/G CO) = ; Case /B)UE/G CO) = 1 Case /F7EE3/G CO) = 2 Case /7EE/G CO) = # Case /0E))OC/G CO) = * End Select Text1.ForeColor = 6BColor.CO)5 End Sub Private Sub Combo2_Click() Text1.FontSi<e = Co$bo2.Text End Sub Private Sub Form_ oad() Text1.Text = Clear End Sub Private Sub #e$t1_C"an'e() Text1.Font3a$e = /%7I%) B)%C&/ End Sub

1-

Computer Applications-II

LAB-1

Working with 0icture Box " 1mage Contro)

Private Sub Command1_Click() I$a,e1.Aicture = )oadAicture./CGH)U3C:.FIF/5 End Sub Private Sub Command2_Click() Aicture1.Aicture = )oadAicture./CGH)U3C:.FIF/5 End Sub

PIC#-./ 0!1

I2A3/ C!4#.!

19

Computer Applications-II

LAB-1! Creating a sma)) 0icture 2iewer


Private Sub Command1_Click() End End Sub Private Sub 5ir1_C"an'e() File1.Aath = Eir1.Aath End Sub Private Sub 5rive1_C"an'e() Eir1.Aath = Eri2e1.Eri2e End Sub Private Sub File1_Click() I$a,e1.Aicture = )oadAicture.File1.Aath I /H/ I File1.File3a$e5 End Sub

1=

Computer Applications-II

LAB-1# Working with 3imer Contro)


Private Sub Command1_Click() Ti$er1.Enabled = False End Sub Private Sub Command2_Click() Ti$er1.Enabled = True End Sub Private Sub #imer1_#imer() If I$a,e2. isible = True Then I$a,e2. isible = False I$a,e1. isible = True Else I$a,e2. isible = True I$a,e1. isible = False End If End Sub

2;

Computer Applications-II

LAB-1(a Working with 4ich3extBox


Private Sub Command1_Click() If 7ichTextBox1.SelBold = True Then 7ichTextBox1.SelBold = False Else 7ichTextBox1.SelBold = True End If End Sub Private Sub Command2_Click() If 7ichTextBox1.SelItalic = True Then 7ichTextBox1.SelItalic = False Else 7ichTextBox1.SelItalic = True End If End Sub Private Sub Command3_Click() If 7ichTextBox1.SelUnderline = True Then 7ichTextBox1.SelUnderline = False Else 7ichTextBox1.SelUnderline = True End If End Sub Private Sub Form_ oad() 7ichTextBox1.Text = Clear End Sub

21

Computer Applications-II

LAB-1(b 4ich3extBox 5&a6e'i)e " Load'i)e7


Private Sub Command1_Click() Co$$onEialo,1.ShoJOpen 7ichTextBox1.)oadFile .Co$$onEialo,1.filena$e5 End Sub Private Sub Command2_Click() Co$$onEialo,1.ShoJSa2e 7ichTextBox1.Sa2eFile .Co$$onEialo,1.filena$e5 End Sub Private Sub Command3_Click() Co$$onEialo,1.ShoJColor 7ichTextBox1.SelColor = Co$$onEialo,1.Color End Sub Private Sub Command+_Click() Co$$onEialo,1.ShoJColor 7ichTextBox1.Bac"Color = Co$$onEialo,1.Color End Sub Private Sub Form_ oad() 7ichTextBox1.Text = Clear End Sub

22

Computer Applications-II

LAB-1(c Cut 8 Cop% " 0aste in 4ich3extBox


Private Sub Command1_Click() Clipboard.SetText 7ichTextBox1.SelText 7ichTextBox1.SelText = Clear End Sub Private Sub Command2_Click() Clipboard.SetText 7ichTextBox1.SelText End Sub Private Sub Command3_Click() 7ichTextBox1.SelText = Clipboard.FetText End Sub Private Sub Form_ oad() 7ichTextBox1.Text = Clear End Sub Private Sub .ic"#e$t0o$1_C"an'e() 7ichTextBox1.Font = /%7I%) B)%C&/ End Sub

2!

Computer Applications-II

LAB-1(d 4ich3extBox with Combo Box


Private Sub Combo1_Click() Select Case .Co$bo1.Text5 Case /BO)E/ 7ichTextBox1.SelBold = True Case /IT%)IC/ 7ichTextBox1.SelItalic = True Case /U3EE7)I3E/ 7ichTextBox1.SelUnderline = True Case /3O7+%)/ 7ichTextBox1.SelBold = False 7ichTextBox1.SelItalic = False 7ichTextBox1.SelUnderline = False End Select End Sub Private Sub Form_ oad() 7ichTextBox1.Text = Clear End Sub Private Sub .ic"#e$t0o$1_C"an'e() 7ichTextBox1.Font = /%7I%) B)%C&/ End Sub

2#

Computer Applications-II

LAB-1* Working with +u)tip)e 'orms

Private Sub Command1_Click() For$2.ShoJ For$2.Text1.Text = For$1.Text1.Text For$2.Text2.Text = For$1.Text2.Text For$2.Text!.Text = For$1.Text!.Text For$2.Text1.Enabled = False For$2.Text2.Enabled = False For$2.Text!.Enabled = False End Sub Private Sub Form_ oad() Text1.Text = Clear Text2.Text = Clear Text!.Text = Clear End Sub

Private Sub Command1_Click() +e.:ide For$1.Text1.SetFocus End Sub Private Sub Command2_Click() End End Sub

2(

Computer Applications-II

LAB-2, Working with 'rames


Private Sub !ption1_Click() If Option1. alue = True Then )abel1.Font3a$e = Option1.Caption End If End Sub Private Sub !ption2_Click() If Option2. alue = True Then )abel1.Font3a$e = Option2.Caption End If End Sub Private Sub !ption3_Click() If Option!. alue = True Then )abel1.Font3a$e = Option!.Caption End If End Sub Private Sub !ption+_Click() If Option#. alue = True Then )abel1.FontSi<e = Option#.Caption End If End Sub Private Sub !ption,_Click() If Option(. alue = True Then )abel1.FontSi<e = Option(.Caption End If End Sub Private Sub !ption*_Click() If Option*. alue = True Then )abel1.FontSi<e = Option*.Caption End If End Sub

2*

Computer Applications-II

LAB-21 Working with 1nput Box


Private Sub Command1_Click() S = InputBox./E3TE7 ST%7TI3F 3U+BE7/5 E = InputBox./E3TE7 E3EI3F 3U+BE7/5 T = InputBox./E3TE7 T%B)E 3U+BE7/5 For % = S To E Arint TB /8/B %B /=/B T 8 % 3ext End Sub

2-

Computer Applications-II

LAB-22 Working with &)ider


Private Sub Form_ oad() 7ichTextBox1.Text = Clear Slider1.+in = 9 Slider1.+ax = *; Slider1.)ar,eChan,e = ( End Sub Private Sub .ic"#e$t0o$1_C"an'e() 7ichTextBox1.Font = /%7I%) B)%C&/ End Sub Private Sub Slider1_Click() 7ichTextBox1.SelFontSi<e = Slider1. alue )abel1.Caption = Slider1. alue End Sub

29

Computer Applications-II

LAB-23 Working with 49B Co)ors


Ei$ red %s Inte,er Ei$ ,reen %s Inte,er Ei$ blue %s Inte,er Private Sub Command1_Click() End End Sub Private Sub (Scroll1_C"an'e() red = :Scroll1. alue Text1.Text = red )abel1.Bac"Color = 7FB.red1 ;1 ;5 )abel#.Bac"Color = 7FB.red1 ,reen1 blue5 End Sub Private Sub (Scroll2_C"an'e() ,reen = :Scroll2. alue Text2.Text = ,reen )abel2.Bac"Color = 7FB.;1 ,reen1 ;5 )abel#.Bac"Color = 7FB.red1 ,reen1 blue5 End Sub Private Sub (Scroll3_C"an'e() blue = :Scroll!. alue Text!.Text = blue )abel!.Bac"Color = 7FB.;1 ;1 blue5 )abel#.Bac"Color = 7FB.red1 ,reen1 blue5 End Sub

2=

Computer Applications-II

LAB-24 Working with 3oo)Bars


Private Sub #oolbar1_0uttonClick(0&)al 0utton As 2SComctl ib60utton) If Button.&e' = /Bold/ Then If Toolbar1.Buttons.Ite$.15. alue = tbrAressed Then Text1.FontBold = True Else Text1.FontBold = False End If End If If Button.&e' = /Italic/ Then If Toolbar1.Buttons.Ite$.25. alue = tbrAressed Then Text1.FontItalic = True Else Text1.FontItalic = False End If End If If Button.&e' = /Underline/ Then If Toolbar1.Buttons.Ite$.!5. alue = tbrAressed Then Text1.FontUnderline = True Else Text1.FontUnderline = False End If End If If Button.&e' = /Stri"e/ Then If Toolbar1.Buttons.Ite$.#5. alue = tbrAressed Then Text1.FontStri"ethru = True Else Text1.FontStri"ethru = False End If End If End Sub

!;

Computer Applications-II

LAB-2

Working with 'orm 3abs

Private Sub Command1_Click() SSTab1.TabCaption.;5 = Text1.Text I / Aersonal Info/ SSTab1.Tab = 1 Text#.SetFocus End Sub Private Sub Command3_Click() SSTab1.Tab isible.;5 = False SSTab1.Tab = 2 Text-.SetFocus End Sub Private Sub Command+_Click() Text=.Text = al.Text-.Text5 D al.Text9.Text5 Text=.Enabled = False End Sub Private Sub Form_ oad() Text1.Text = Clear Text2.Text = Clear Text!.Text = Clear Text#.Text = Clear Text(.Text = Clear Text*.Text = Clear Text-.Text = Clear Text9.Text = Clear Text=.Text = Clear End Sub

!1

Computer Applications-II

LAB-2!a Creating .atabase in 2B


1. Open %ddDIns $enu 2. Clic" isual Eata +ana,er !. Open File $enu #. Aoint to 3eJ (. Aoint to +icrosoft %ccess *. Clic" ersion -.; +EB -. Select path Jhere 'ou Jant to sa2e database file 9. T'pe database filena$e =. Clic" Sa2e Button 1;. 7i,ht clic" on Eatabase CindoJ 11. Clic" 3eJ Table 12. T'pe Table 3a$e 1!. Clic" %dd Field button 1#. %dd the folloJin, fields 4A2/ 5/PA.#2/4# SA A.8 1(. Clic" Close button 1*. Clic" Build the Table button 1-. Eouble clic" table na$e 19. %dd records 1=. Close isual Eata +ana,er #/1# #/1# I4#/3/. 27 27 2 .i.e.1 IOB+5 .i.e.1 EGH'our folder5

!2

Computer Applications-II

LAB-2!b .atabase Connecti6it% with .ata Contro)


Private Sub Command1_Click() Eata1.7ecordset.%dd3eJ Text1.SetFocus End Sub Private Sub Command17_Click() r = /select 8 fro$ ict Jhere depart$ent = K/ I Text#.Text I /K / Eata1.7ecordSource = r Eata1.7efresh End Sub Private Sub Command2_Click() Eata1.7ecordset.Update End Sub Private Sub Command3_Click() If 3ot Eata1.7ecordset.7ecordCount ? Eata1.7ecordset.7ecordCount Then Eata1.7ecordset.+o2e3ext If Eata1.7ecordset.EOF Then Eata1.7ecordset.+o2e)ast End If End If End Sub Private Sub Command+_Click() If 3ot Eata1.7ecordset.7ecordCount ? Eata1.7ecordset.7ecordCount Then Eata1.7ecordset.+o2eAre2ious If Eata1.7ecordset.BOF Then Eata1.7ecordset.+o2eFirst End If End If End Sub Private Sub Command,_Click() Eata1.7ecordset.+o2e)ast End Sub Private Sub Command*_Click() Eata1.7ecordset.+o2eFirst End Sub Private Sub Command9_Click() Eata1.7ecordset.Eelete !!

Computer Applications-II Eata1.7ecordset.+o2eAre2ious End Sub Private Sub Command:_Click() cri = /na$e= K/ I Text#.Text I /K / Eata1.7ecordset.FindFirst cri If Eata1.7ecordset.3o+atch Then +s,Box /record not found/ End If End Sub Private Sub Command;_Click() Eata1.7ecordset.Edit End Sub Private Sub Form_Activate() Text#.SetFocus End Sub Private Sub Form_ oad() Text#.Text = Clear End Sub

!#

Computer Applications-II

LAB-2#a Creating Acti6e-: Contro)


16 !pen )isual 0asic 26 Select Active-1 Control instead o< Standard /$e <rom 4e= Pro>ect =indo= (A <orm =ill be displa&ed =it"out #itle 0ar) 36 5ra= a Combo 0o$ on <orm +6 Fill t"e <ollo=in' in t"e combo usin' IS# propert& (#2 F AS( 21 P(!#!S(!P F.!4# PA3/ ?A)A SC.IP# ASP ,6 Form si@e s"ould be accordin' t"e si@e o< t"e Combo 0o$ control *6 !pen File menu 96 Click Save Pro>ect :6 #&pe <ilename C!-.S/S in bot" <ile ;6 !pen File menu 176 Click 2ake Courses6oc$A 116 #&pe <ilename C!-.S/S 126 Select Pro>ect 1 (Courses6vbp) <rom Pro>ect /$plorer =indo= 136 C"an'e pro>ect name <rom Pro>ect1 to Courses 1+6 Press /nter 1,6 Save pro>ect once a'ain 1*6 !pen File menu 196 Click .emove Pro>ect 1:6 !pen File menu 1;6 Click 4e= Pro>ect 276 Select Standard /$e 216 Click !k 226 .i'"t Click #oolbo$ 236 click Component 2+6 c"eck Courses <rom list and click !% 2,6 4o= 5ra= it on <orm

!(

Computer Applications-II

LAB-2#b .atabase Connecti6it% with A.O


Ei$ e$pLcon %s %EOEB.Connection Ei$ e$pLrec %s %EOEB.7ecordset Private Sub Command1_Click() e$pLrec.%dd3eJ clbox Text1.SetFocus End Sub Private Sub Command2_Click() updaterec End Sub Private Sub Command3_Click() If 3ot e$pLrec.7ecordCount ? e$pLrec.7ecordCount Then e$pLrec.+o2e3ext displa'rec If e$pLrec.EOF Then e$pLrec.+o2e)ast displa'rec End If End If End Sub Private Sub Command+_Click() If 3ot e$pLrec.7ecordCount ? e$pLrec.7ecordCount Then e$pLrec.+o2eAre2ious displa'rec If e$pLrec.BOF Then e$pLrec.+o2eFirst displa'rec End If End If End Sub Private Sub Command,_Click() e$pLrec.+o2e)ast displa'rec End Sub Private Sub Command*_Click() e$pLrec.+o2eFirst !*

Computer Applications-II displa'rec End Sub Private Sub Command9_Click() e$pLrec.Eelete +s,Box /7ecord Successfull' Eeleted/1 2bInfor$ation End Sub Private Sub Command:_Click() Ei$ r %s %EOEB.7ecordset Set r = 3eJ %EOEB.7ecordset r.Open /select 8 fro$ ict Jhere depart$ent = K/ I Text#.Text I /K /1 e$pLcon1 adOpenE'na$ic1 ad)oc"Opti$istic Set %dodc1.7ecordset = r Call %dodc1.7efresh End Sub Private Sub Form_Activate() clbox displa'rec End Sub Private Sub Form_ oad() Set e$pLcon = 3eJ %EOEB.Connection e$pLcon.ConnectionStrin, = /dsn=e$p/ e$pLcon.Open Set e$pLrec = 3eJ %EOEB.7ecordset e$pLrec.Open /select 8 fro$ ict/1 e$pLcon1 adOpenE'na$ic1 ad)oc"Opti$istic End Sub Sub clbo$() Text1.Text = Clear Text2.Text = Clear Text!.Text = Clear End Sub Sub displa&rec() On Error 7esu$e 3ext Text1.Text = e$pLrec.Fields./na$e/5. alue Text2.Text = e$pLrec.Fields./depart$ent/5. alue Text!.Text = e$pLrec.Fields./salar'/5. alue End Sub Sub updaterec() e$pLrec.Fields./na$e/5. alue = Text1.Text

!-

Computer Applications-II e$pLrec. ./depart$ent/5. alue = Text2.Text e$pLrec.Fields./salar'/5. alue = Text!.Text e$pLrec.Update +s,Box /7ecord Updated/1 2bInfor$ation End Sub

!9

Computer Applications-II

LAB-2( Creating Connection o; A.O.C1 Contro)


16 .i'"t click A5!5C1 Control 26 Click A5!5C Properties 36 Click 0uild button +6 Select 2icroso<t >et +67 ! / 50 Provider ,6 Click 4e$t *6 Select 5atabase <ile 96 Click #est Connection button :6 Click !% ;6 Click !% 176 Click recordsource tab 116 Select adcmdtable <rom <irst combo 126 Select table name <rom second combo 136 Click ok

!=

Anda mungkin juga menyukai