Anda di halaman 1dari 22

KUMPULAN PROGRAM KECIL Program2 kecil ini pernah di posting ke forum fox-id.org : Sample pemakaian LPARAMETER : CLEAR SE PR!

CE"#RE ! m$tolo %m$tolo&'halo (ali....') PR!CE"#RE m$tolo LPARA*E ERS mpApaA+a ,A- ,-."!, mpApaA+a E."PR!C Sample pemakaian LIKE %....% : //dian0sastro //2112 SE AL3 !44 SE SA4E 5 !44 clear CREA E A6LE cari 4REE &kelomp c&71)8nama c&21)8 ket c&21)) -.SER -. ! cari &kelomp8nama8ket) 9AL#ES &'mamalia'8'sapi'8'sapi tidak mengem(ik') -.SER -. ! cari &kelomp8nama8ket) 9AL#ES &'mamalia'8'sapi (ali'8'sapi (ali +g tidak mengem(ik') -.SER -. ! cari &kelomp8nama8ket) 9AL#ES &'mamalia'8'kam(ing'8'kam(ing mengem(ik') -.SER -. ! cari &kelomp8nama8ket) 9AL#ES &'insect'8'lalat'8'lalat kok mengaum :') L!CAL cSatu8c"ua8c iga cSatu %;kelomp %'mamalia'; c"ua %;nama like '<sapi<' ; c iga %;ket like '<em(ik<' ; cEmpat %;kelomp %'insect'; //contoh 7 SELEC / from cari ,=ERE > ?cSatu > A." > ?c"ua > !R > ?c iga > -. ! C#RS!R a(c 6R!,SE //contoh 2 cuma cari ;sapi;

@ m$tolo 211A B kumpulan prg kecil

SELEC / from cari ,=ERE > ?c"ua > -. ! C#RS!R a(c 6R!,SE //contoh C cari kelomp insect a+a SELEC / from cari ,=ERE > ?cEmpat > -. ! C#RS!R a(c 6R!,SE -4 #SE"&'cari') #SE -. cari E."-4 Sample combo 1 : /D/ dian s 2112 especiallE F u /D/ Ganita (erhak atas tu(uh dia sendiri - d+enar maesa aEu /D/ poGered (E HfpI L!CAL od4orm as 4orm od4orm%CREA E!6JEC &'dian4!R*') od4orm.ShoG&7) RE #R. "E4-.E CLASS dian4!R* as 4orm autocenter%.t. height%F11 Gidth%K11 Caption%;"S 2112 ketika anda tidur kami sedang koding :) ; A"" !6JEC la(el7 as la(el ,- = > op % 718 > Left % 218 > Autosi$e%.t.8> Caption %;.ama :; A"" !6JEC la(el2 as la(el ,- = > op % C18 > Left % 218 > Autosi$e%.t.8> Caption %;Loe perlu gue ada :);8> 4ontsi$e%CA8> 4ont6old%.t. A"" !6JEC la(elC as la(el ,- = >

@ m$tolo 211A B kumpulan prg kecil

op % 7118 > Left % 218 > Autosi$e%.t.8> Caption %;-nti se(enarnEa di penulisan SELEC ...;8> 4ontsi$e%2F8> 4ont6old%.t.8> 4oreColor%RL6&2228181) A"" !6JEC com(ro7 as com(o(ox ,- = > op % 718 > Left % 7118 > ,idth%7218> Controlsource%;t(l0i.kode;8> RoGsourcetEpe%C8> RoGsource%;select a.kode8(.nama from t(l0r a8t(l0i ( Ghere a.kode%(.kode into curs curCucur order (E a.kode;8> 6oundColumn%78> ColumnCount%2 A"" !6JEC keluar AS command(utton ,- = > op % CA18 > Left % 2118 > =eight % C18 > ,idth % I18 > Caption % ;MNClose; PR!CE"#RE load SE AL3 off SE S A #S !. SE C!.4-R* !44 SE SA4E 5 !44 CLEAR CREA E A6LE t0induk 4REE &kode c&2)8nama c&21)) -.SER -. ! t0induk &kode8nama) 9AL#ES &;117;8;6adu;) -.SER -. ! t0induk &kode8nama) 9AL#ES &;112;8;6udi;) -.SER -. ! t0induk &kode8nama) 9AL#ES &;11C;8;Ali opan;) -.SER -. ! t0induk &kode8nama) 9AL#ES &;11F;8; suminah;) CREA E A6LE t0refer 4REE &kode c&2)8 deskripsi c&71)) -.SER -. ! t0refer &kode8deskripsi) 9AL#ES &;112;8;*akan 6aso;) -.SER -. ! t0refer &kode8deskripsi) 9AL#ES &;11F;8;Lagi *engamuk;) -.SER -. ! t0refer &kode8deskripsi) 9AL#ES &;11C;8; urun Jalan;) CL!SE ALL SELEC 1 #SE t0induk AL-AS t(l0i

@ m$tolo 211A B kumpulan prg kecil

SELEC 1 #SE t0refer AL-AS t(l0r E."PR!C PR!CE"#RE keluar.Click -4 #SE"&'t(l0i') #SE -. t(l0i E."-4 -4 #SE"&'t(l0r') #SE -. t(l0r E."-4 hisform.release E."PR!C PR!CE"#RE com(ro7.destroE -4 #SE"&'curC#C#R') #SE -. curC#C#R E."-4 E."PR!C E.""E4-.E Sample combo : /D/ dian s 2112 especiallE F u /D/ Ganita (erhak atas tu(uh dia sendiri - d+enar maesa aEu /D/ poGered (E HfpI L!CAL od4orm as 4orm od4orm%CREA E!6JEC &'dian4!R*') od4orm.ShoG&7) RE #R. "E4-.E CLASS dian4!R* as 4orm autocenter%.t. height%F11 Gidth%K11 Caption%;"S 2112 ketika anda tidur kami sedang koding :) ; A"" !6JEC la(el7 as la(el ,- = > op % 718 > Left % 218 > Autosi$e%.t.8> Caption %;Agama :; A"" !6JEC com(ro7 as com(o(ox ,- = > op % 718 >

@ m$tolo 211A B kumpulan prg kecil

Left % 7118 > ,idth%2118> Controlsource%;t(l0i.agama;8> RoGsourcetEpe%C8> RoGsource%;select deskripsi8kode from t(l0r into curs curCucur order (E kode;8> 6oundColumn%2 A"" !6JEC keluar AS command(utton ,- = > op % CA18 > Left % 2118 > =eight % C18 > ,idth % I18 > Caption % ;MNClose; PR!CE"#RE load SE AL3 off SE S A #S !. SE C!.4-R* !44 SE SA4E 5 !44 CLEAR CREA E A6LE t0induk 4REE &agama c&2)) -.SER -. ! t0induk &agama) 9AL#ES &;117;) CREA E A6LE t0refer 4REE &kode c&2)8 deskripsi c&71)) -.SER -. ! t0refer &kode8deskripsi) 9AL#ES &;117;8;-SLA*;) -.SER -. ! t0refer &kode8deskripsi) 9AL#ES &;112;8;3R-S E.;) -.SER -. ! t0refer &kode8deskripsi) 9AL#ES &;11C;8;6#"=A;) CL!SE ALL SELEC 1 #SE t0induk AL-AS t(l0i SELEC 1 #SE t0refer AL-AS t(l0r E."PR!C PR!CE"#RE keluar.Click //programmer Eg sopan selalu cek dg Halidasi2 Eg mencukupi -4 #SE"&'t(l0i') #SE -. t(l0i E."-4 -4 #SE"&'t(l0r') #SE -. t(l0r E."-4 hisform.release E."PR!C E.""E4-.E ?? dEnamic memorE alocation

@ m$tolo 211A B kumpulan prg kecil

Sample !ec"#p$ %e!e"&ana : //contoh decrEpt pGd sederhana //m$tolo 211F LPARA*E ERS data0ecr L!CAL xx8EE8$$8GG8aa8i8cc S !RE 1 ! i8((8GG S !RE '' ! xx8EE8$$8aa8cc8dd xx%'A6C"E4L=-J3L*.!PORS #9,P5Q' EE%'*.!PORS #9,P5QA6C"E4L=-J3L' $$%ALL R-*&#PPER&data0ecr)) GG%LE.&$$) 4!R i%7 ! GG aa%S#6S R&$$8i87) ((%A &aa8EE) cc%S#6S R&xx8((87) dd%ddRcc E."4!R RE #R. dd Sample enc"#p$ %e!e"&ana : //contoh encrEpt pGd sederhana //m$tolo 211F LPARA*E ERS data0asli L!CAL xx8EE8$$8GG8aa8i8cc S !RE 1 ! i8((8GG S !RE '' ! xx8EE8$$8aa8cc8dd xx%'A6C"E4L=-J3L*.!PORS #9,P5Q' EE%'*.!PORS #9,P5QA6C"E4L=-J3L' $$%ALL R-*&#PPER&data0asli)) GG%LE.&$$) 4!R i%7 ! GG aa%S#6S R&$$8i87) ((%A &aa8xx) cc%S#6S R&EE8((87) dd%ddRcc E."4!R RE #R. dd

@ m$tolo 211A B kumpulan prg kecil

Sample CA !' !a$aba%e acce%% : /D/ dian s 2112 especiallE F u /D/ data(ase access &md() /D/ connection od(c8 poGered (E class cursor adapter L!CAL od4orm as 4orm od4orm%CREA E!6JEC &'dian4!R*') od4orm.ShoG&7) RE #R. "E4-.E CLASS dian4!R* as 4orm autocenter%.t. height%F11 Gidth%K11 Caption%;"S 2112; A"" !6JEC la(el7 as la(el ,- = > op % 718 > Left % 218 > Autosi$e%.t.8> Caption%;3ode :; A"" !6JEC text7 as text(ox ,- = > op % 718 > Left % 7118 > ,idth% 2118> controlsource % ;dian.kode; A"" !6JEC la(el2 as la(el ,- = > op % F18 > Left % 218 > Autosi$e%.t.8> Caption%;.ama :; A"" !6JEC text2 as text(ox ,- = > op % F18 > Left % 7118 > ,idth% 2118> controlsource % ;dian.nama; A"" !6JEC keluar AS command(utton ,- = > op % CA18 > Left % 2118 > =eight % C18 > ,idth % I18 > Caption % ;MNClose;

@ m$tolo 211A B kumpulan prg kecil

A"" !6JEC kemon AS command(utton ,- = > op % CA18 > Left % C118 > =eight % C18 > ,idth % I18 > Caption % ;MN.ext; A"" !6JEC (alik AS command(utton ,- = > op % CA18 > Left % 2118 > =eight % C18 > ,idth % I18 > Caption % ;MNPreH; PR!CE"#RE load pu(lic loCursor as CursorAdapter8 laerrorS7T SE *#L -L!C3S !. loCursor%CREA E!6JEC &'CursorAdapter') ,- = loCursor .alias %;dian; .datasourcetEpe%;!"6C; ."atasource%sUlstringconnect&;"riHer%V*icrosoft &/.md()W>"(U%C:Mdian.md(>#id%>PGd%>;) .selectcmd%;select / from t0dian; .Cursor4ill&) E.",- = E."PR!C PR!CE"#RE keluar.Click -4 #SE"&'dian') #SE -. dian E."-4 hisform.release E."PR!C PR!CE"#RE kemon.Click S3-P -4 E!4&) L! 6! !* ,A- ,-."!, 'akhir DD' noGai E."-4 thisform.Refresh E."PR!C

Access

"riHer

@ m$tolo 211A B kumpulan prg kecil

PR!CE"#RE (alik.Click S3-P -7 -4 6!4&) L! !P ,A- ,-."!, 'aGal DD' noGai E."-4 thisform.Refresh E."PR!C E.""E4-.E Sample pe"(ba&an nomo" o$oma$i% : //dian0sastro //2112 CLEAR SE safetE !44 L!CAL nomorku CREA E A6LE dian2 &nomor c&71)) -.SER -. ! dian2 &nomor) 9AL#ES &'a117') -.SER -. ! dian2 &nomor) 9AL#ES &'(117') //-.SER -. ! dian2 &nomor) 9AL#ES &'$117') peru(ahan ke a112

?? ini anda (isa pakai tuk cek

SELEC --4&*AP&LE4 &nomor87))%'$'8'a'R > right&'1111'RALL R-*&S R&Hal&S#6S R&*AP&nomor)828LE.&ALL R-*&*AP&nom or)))-7))R7))8C)8> C=R&ASC&*AP&LE4 &nomor87)))R7) R right&'1111'RALL R-*&S R&Hal&S#6S R&*AP&nomor)828LE.&ALL R-*&*AP&nom or)))-7))))8C)) > as nomor0terakhir 4R!* dian2 -. ! C#RS!R curCucur SELEC curCucur -4 0tallEX1 nomorku%curCucur.nomor0terakhir ELSE nomorku%'a117' E."-4 //nongolnEa seharusnEa 'c117' : nomorku -4 #SE"&'dian2') #SE -. dian2 E."-4

@ m$tolo 211A B kumpulan prg kecil

Sample pemakaian $ime" !an con$o& $e)$ #' be"*alan : /D/ dian s 2112 especiallE F u L!CAL od4orm as 4orm od4orm%CREA E!6JEC &'dian4!R*') od4orm.ShoG&7) RE #R. "E4-.E CLASS dian4!R* as 4orm autocenter%.t. height%F11 Gidth%K11 Caption%;"S 2112; A"" !6JEC la(el7 as la(el ,- = > op % 718 > Left % 2118 > Autosi$e%.t.8> Caption%;"-A. SA R! JALA.-JALA. S!RE; A"" !6JEC text7 as text(ox ,- = > op % 7118 > Left % 2118 > ,idth%711 A"" !6JEC -nterHal % 71 imer7 as dian imer ,- = >

A"" !6JEC keluar AS command(utton ,- = > op % CA18 > Left % 2118 > =eight % C18 > ,idth % I18 > Caption % ;MNClose; PR!CE"#RE init %A""PR!PER 5&this8'kekiri'8.t.) E."PR!C PR!CE"#RE keluar.Click hisform.release E."PR!C E.""E4-.E "E4-.E CLASS dian imer as imer !LEClass % ; imer; PR!CE"#RE imer

@ m$tolo 211A B kumpulan prg kecil

71

L!CAL ndian ndian%thisform.kekiri if ndian -4 hisform.la(el7.Left%7 hisform.kekiri%.f. ELSE hisform.la(el7.Left% hisform.la(el7.Left-7 E."-4 ELSE -4 hisform.la(el7.Left%211 thisform.kekiri%.t. ELSE hisform.la(el7.Left% hisform.la(el7.LeftR7 E."-4 endif hisform.refresh E."PR!C E.""E4-.E Sample pen(li%an !an pembacaan "e'i%$"# : //dian s 7 hari s(elom tgl 7K Agustus 2112 //simpan coding (erikut di dalam ;regsample.prg; //cara pakainEa di Hfp GindoG command : //set procedure to regsample.prg sesuai nama simpannEa //dd%regitulooh&.t.) : .t. tuk tulis8 .f. tuk (aca //: dd //cara pakai ini tidak mengikat ini semata-mata hanEa tuk kondisi sample ini //pahami konsep (acaZtulis ke registrE di (aGah :) [define kontrol0error 1 [define =3E50L!CAL0*AC=-.E -27FKFICAFA [define =3E50C#RRE. 0#SER -27FKFICAFK [define 3E50O#ER509AL#E 7 ?? 7 unt string PR!CE"#RE regitulooh LPARA*E ERS aksi SE talk !44 CLEAR /-- sepindah sampun kesupen andeclarekan "LL8 hukumnEa Ga+i( 'ain declare integer Reg!pen3eEEx in ,inC2AP- > integer n3eE8 string \cSu(3eE8 integer nReserHed8> integer nAccess*ask8 integer \nResult "ECLARE -nteger RegOuerE9alueEx -. ,inC2AP- > -nteger n=3eE8 String lps$9alue.ame8 -nteger dGReserHed8> -nteger \lpdG Epe8 String \lp("ata8 -nteger \lpc("ata

@ m$tolo 211A B kumpulan prg kecil

77

declare integer RegCreate3eE in ,inC2AP- > integer n=3eE8 string \cSu(3eE8 integer \nResult declare integer RegClose3eE in ,inC2AP- > integer n=3eE declare integer RegSet9alueEx in ,inC2AP- > integer h3eE8 string lps$9alue.ame8 integer dGReserHed8> integer fdG Epe8 string lp("ata8 integer c("ata //-local lc6uffer8 ln6ufferSi$e8lcRet9al8 lnReserHed8 lnResult8 lnError8 > ln Epe8 lc3eE8 "ian8 s"ian8 s"s8 lc=asil8 lc=as store 1 to lnReserHed8 lnResult8 ln Epe "ian % iif&emptE&aksi) or aksi % .f.8.f.8.t.) // .f. tuk mem(aca reg8 .t. tuk menulis ... ini sample a+a anda (isa kem(angkan deGe lc6uffer % space&72I) ln6ufferSi$e % len&lc6uffer) s"s % ;.LLA3 PER.A= A"A *A -.5E;RC=R&1) s"ian % len&s"s) lc=asil % ;; if "ian //stl declare "LL di atas tuk nulisZ(aca ke registrE &7st step) //pake RegCreate3eE (erfungsi tuk create keE di registrEnEa &2nd step) lnError%RegCreate3eE&=3E50C#RRE. 0#SER8;SoftGareM4ox-idMV pernah mencintaiku :) W;8\lnResult) +gn

if lnError % kontrol0error //pake RegSet9alueEx (erfungsi tuk mengisiZset Halue dari keE Eg telah di create &Crd step) %RegSet9alueEx&lnResult8;*! ! =-"#P;8183E50O#ER509AL#E8s"s8s"ian) lc=asil%;PE.#L-SA. 3E REL-S R5 S#3SES; endif else //stl declare "LL di atas tuk nulisZ(aca ke registrE &7st step) //pake Reg!pen3eEEx (erfungsi tuk cek apakah keE Eg akan di (aca ada di registrE &2nd step) //perhatikan saEa memakai angka ;-27FKFICAFK; ini sama dg '=3E50C#RRE. 0#SER'

@ m$tolo 211A B kumpulan prg kecil

72

lnError%Reg!pen3eEEx&-27FKFICAFK8 ;SoftGareM4ox-idMV mencintaiku :) W;8 > lnReserHed8 3E50O#ER509AL#E8 \lnResult)

+gn

pernah

if lnError % kontrol0error ln Epe %1 lc6uffer % SPACE&72I) ln6ufferSi$e% LE.&lc6uffer) //pake RegOuerE9alueEx (erfungsi tuk mem(aca isiZHalue dari keE Eg diinginkan &Crd step) lnError % RegOuerE9alueEx&lnResult8 ;*! ! =-"#P;8 lnReserHed8 > \ln Epe8 \lc6uffer8 \ln6ufferSi$e) -4 lnError % kontrol0error A." lc6uffer NX C=R&1) lc=as % LE4 &lc6uffer8 ln6ufferSi$e - 7) lc=asil %lc=as R ; ini hasil pem(acaan registrE; E."-4 endif endif //mengakhiri setiap penulisanZpem(acaan ke registrE &Fth step) %RegClose3eE&lnResult) RE #R. lc=asil Sample +o"m $"an%pa"an : /D/ dian s 2112 especiallE F u - dari solution Hfp /D/ thanks tuk mas ham(ud Eg mem(erikanku semangat scr tdk langsung /D/ tuk menampilkan sample ini /D/ peringatan pemerintah : ini hanEa untuk 94PI dan minimal ,in 2111 L!CAL od4orm as 4orm od4orm%CREA E!6JEC &'dian4!R*') od4orm.ShoG&7) REA" E9E. S "E4-.E CLASS dian4!R* as 4orm autocenter%.t. (ackcolor%RL6&2CA82CC827A) height%F11 Gidth%K21 Caption%;Segala Eg transparan selalu menggoda hati :); shoGGindoG%2 ?? As op LeHel PER=A -3A. -.- DD agar (isa transparan A"" !6JEC la(el7 as la(el ,- = > op % 718 > Left % 728 > Autosi$e%.t.8> 4ont6old%.t.8>

@ m$tolo 211A B kumpulan prg kecil

7C

4ontsi$e%C18> 4orecolor%RL6&2228181)8> Caption%;=A --=A - A"A PE.A*PA3A. :); PR!CE"#RE init //declarekan ini dulu "ECLARE Set,indoGLong -n ,inC2Api AS 0Sol0Set,indoGLong -nteger8 -nteger8 -nteger "ECLARE SetLaEered,indoGAttri(utes -n ,inC2Api AS 0Sol0SetLaEered,indoGAttri(utes -nteger8 String8 -nteger8 -nteger 0Sol0Set,indoGLong&this.h,nd8 -218 1x111I1111) 0Sol0SetLaEered,indoGAttri(utes&this.h,nd8 18 2228 2) E."PR!C PR!CE"#RE "estroE //+o lali tuk clear "LLs Eg tadi di declare CLEAR "LLS 0Sol0Set,indoGLong CLEAR "LLS 0Sol0SetLaEered,indoGAttri(utes E."PR!C A"" !6JEC keluar AS command(utton ,- = > op % 2A18 > Left % 2118 > =eight % C18 > ,idth % I18 > Caption % ;MNClose; A"" !6JEC aksi AS command(utton ,- = > op % 2A18 > Left % 218 > =eight % C18 > ,idth % I18 > Caption % ;MNAction; A"" !6JEC spinner7 AS spinner ,- = > -ncrement%718> 3eE(oard=igh9alue%2228> 3eE(oardLoG9alue%718> Spinner=igh9alue%222.18> SpinnerLoG9alue%71.18> 9alue%218> op % 2218 > Left % 218 > =eight % C18 >

@ m$tolo 211A B kumpulan prg kecil

7F

,idth % A1 PR!CE"#RE keluar.Click CLEAR E9E. S hisform.release E."PR!C PR!CE"#RE aksi.Click tipisnEa % this.Parent.spinner7.Halue 0Sol0SetLaEered,indoGAttri(utes&this.Parent.h,nd8 18 tipisnEa8 2) E."PR!C E.""E4-.E Sample !a$e $o c&a"ac$e" : //m$tolo 2112 //copE dan simpan function di (aGah dg nama f0tgl.prg //pan+ang lc eks masing2 Y karakter include spasi //set procedure to f0tgl //: tanggal&date&)) > date&) (isa di ganti dg field tanggal //return Halue % karakter 4#.C -!. tanggal LPARA*E ERS d gl local lc eks8d gl28c anggal d gl2%d gl lc eks%;Januari Pe(ruari *aret April *ei Juni Juli Agustus Septem(er!kto(er .opem(er "esem(er ; c anggal%S R&"A5&d gl2)82)R'-'RALL R-*&S#6S R&lc eks8--4&month&d gl2)%7878 month&d gl2)R&Y/&month&d gl2)-7)))8Y))R'-'RS R&5EAR&d gl2)8F) RE #R. c anggal Sample c&a"ac$e" *alan : SE AL3 !44 CLEAR set (ell to 'c:MGindoGsMmediaMding.GaH' SE C!L!R ! ,Z6R aa%'/ / / / / / / / /

'

4!R i%7 ! 21 4!R x%7 ! 2 ll % S#6S R&aa8x8711) \ 282 saE ll :: C=R&K) ,A- '' ! xx -*E!# 1.2 E."4!R E."4!R

@ m$tolo 211A B kumpulan prg kecil

72

Sample &#pe"link $e)$ : /D/ dian s 2112 /D/ contoh sederhana hEperlink pake la(el L!CAL od4orm as 4orm od4orm%CREA E!6JEC &'dian4!R*') od4orm.ShoG&7) RE #R. "E4-.E CLASS dian4!R* as 4orm autocenter%.t. height%F11 Gidth%K11 Caption%;"S 2112; A"" !6JEC la(el7 as la(el ,- = > op % 718 > Left % 218 > Autosi$e%.t.8> 4ont#nderline%.t.8> 4oreColor%RL6&1818222)8> *ousePointer%728> Caption%;GGG.m$tolo.com; A"" !6JEC =Eperlink7 as =Eperlink ,- = > 9isi(le % .f. A"" !6JEC keluar AS command(utton ,- = > op % CA18 > Left % 2118 > =eight % C18 > ,idth % I18 > Caption % ;MNClose; PR!CE"#RE keluar.Click hisform.release E."PR!C PR!CE"#RE la(el7.Click his4orm.=Eperlink7..aHigate o& his.Caption) E."PR!C E.""E4-.E Sample pemakaian cla%% b($$on%.,c) :

@ m$tolo 211A B kumpulan prg kecil

7A

//m$tolo - kala masih (erduka //*!"-45 CLASS : !4 ;c:Mprogram filesMmicrosoft Hisual IMsamplesMclassesM(uttons.Hcx; //anda lihat di class ;(uttons.Hcx; ada tom(ol (ernama ;cmdCancel; SE CLASSL-6 ! ;c:Mprogram filesMmicrosoft Hisual IMsamplesMclassesM(uttons.Hcx; L!CAL o4orm as 4orm o4orm%CREA E!6JEC &'m$4!R*') o4orm.ShoG&7) RE #R. "E4-.E CLASS m$4!R* as 4orm autocenter%.t. height%F11 Gidth%2Y1 Caption%;m$tolo 2112; A"" !6JEC om(ol AS cmdCancel ,- = > op % CA18 > Left % 2118 > =eight % C18 > ,idth % I18 > Caption % ;3eluar; PR!CE"#RE init SE AL3 !44 CLEAR E."PR!C E.""E4-.E

foxpro foxpro

Sample !#namic men( :

@ m$tolo 211A B kumpulan prg kecil

7K

//dian0sastro SE SA4E 5 !44 i%7 "-*E.S-!. menux&2) CREA E A6LE tini& menuku c&71)) -.SER -. ! tini &menuku) Halues &;MN-nHoices;) -.SER -. ! tini &menuku) Halues &;-nMNUuirE;) "E4-.E *E.# mnuReceiHe SELEC tini L! !P SCA. menux&i)%menuku ii%S R&i87) "E4-.E PA" pad?ii !4 mnureceiHe PR!*P menux&i) i%iR7 E."SCA. AC -9A E *E.# mnuReceiHe #SE -. tini Sample pemakaian olecon$"ol S&ell.E)plo"e". : //m$tolo 1K721F S7I:11 Gi(T //sunter - +kt L!CAL o4orm as 4orm o4orm%CREA E!6JEC &'m$4!R*') o4orm.ShoG&7) RE #R. "E4-.E CLASS m$4!R* as 4orm autocenter%.t. height%F11 Gidth%2Y1 Caption%;m$tolo 211F; A"" !6JEC o,E6 as m$!LE= ,- = > op % 718 > Left % 718 > =eight % CF28 > ,idth % 2K18> Hisi(le%.t. A"" !6JEC command7 AS command(utton ,- = > op % CA18 >

@ m$tolo 211A B kumpulan prg kecil

7I

Left % 2118 > =eight % C18 > ,idth % I18 > Caption % ;3eluar; PR!CE"#RE init SE AL3 !44 CLEAR E."PR!C PR!CE"#RE command7.Click hisform.release E."PR!C PR!CE"#RE o,E6.Error LPARA*E ERS nError8 c*ethod8 nLine !. ERR!R return E."PR!C PR!CE"#RE o,E6.-nit // his.naHigate&'c:Mshape0tGeen.sGf') // his.naHigate&'72K.1.1.7Zm$tolZ(ank.asp') t=-S..AHigate&]lari.sGf') E."PR!C E.""E4-.E "E4-.E CLASS m$!LE= as !LEControl !LEClass % ;Shell.Explorer.2; E.""E4-.E Sample b(lan !lm "oma-i : local n8lc eks lc eks%;- -- --- -9 9 9- 9-- 9----P P P- P-- ; n%7 ?? misalkan 'tuk (ulan 78 n%72 'tuk (ulan 72 dst. : S#6S R&lc eks8--4&n%7878nR&C/&n-7)))8F)

Sample Toolba" !i +o"m :

@ m$tolo 211A B kumpulan prg kecil

7Y

//"ian S 2112 //di kamar peraduan (ersama compaU presario L!CAL od4orm as 4orm od4orm%CREA E!6JEC &'"ianS') od4orm.ShoG&7) RE #R. "E4-.E CLASS "ianS as 4orm left %7 top %7 autocenter%.f. height%7I1 Gidth%F11 Caption%;"ianS 2112; A"" !6JEC teks as la(el ,- = > op%718> Left%218> Autosi$e%.t.8> Caption%;"ian Sastro 4ox -" 4ans Clu(; PR!CE"#RE init SE AL3 !44 SE *#L -L!C3S !. CLEAR CL!SE ALL !. ERR!R return E."PR!C PR!CE"#RE actiHate P#6L-C t(r"esktop t(r"esktop % CREA E!6J&'"ian ool') t(r"esktop.S=!,&) E."PR!C PR!CE"#RE destroE t(r"esktop.hide&) RELEASE t(r"esktop E."PR!C E.""E4-.E "E4-.E CLASS "ian ool as ool(ar A"" !6JEC (tn6old AS Command6utton A"" !6JEC sep7 AS Separator A"" !6JEC (tn-talics AS Command6utton A"" !6JEC sep2 AS Separator

@ m$tolo 211A B kumpulan prg kecil

21

A"" !6JEC (tn#nder AS Command6utton (tn6old.=E-L= % 21 (tn6old.,-" = % A1 (tn6old.Caption % ;6old; (tn-talics.=E-L= % 21 (tn-talics.,-" = % A1 (tn-talics.Caption % ;-talic; (tn-talics.4ont6old % .4. (tn-talics.4ont-talic % . . (tn#nder.=E-L= % 21 (tn#nder.,-" = % A1 (tn#nder.Caption % ;#nderline; (tn#nder.4ont#nderline % . . LE4 % 221 !P % 22 ,-" = % 711 CAP -!. % ;"ian 2112; PR!CE"#RE ActiHate this.(tn6old.4ont6old % 0SCREE..4!. 6!L" this.(tn-talics.4ont-talic % 0SCREE..4!. - AL-C E."PR!C PR!CE"#RE (tn6old.CL-C3 0SCREE..ActiHeform.teks.font(old %--4&0SCREE..ActiHeform.teks.font(old8.f.8.t.) E."PR!C PR!CE"#RE (tn-talics.CL-C3 0SCREE..ActiHeform.teks.fontitalic %--4&0SCREE..ActiHeform.teks.fontitalic8.f.8.t.) E."PR!C PR!CE"#RE (tn#nder.CL-C3 0SCREE..ActiHeform.teks.fontunderline %--4&0SCREE..ActiHeform.teks.fontunderline8.f.8.t.) E."PR!C PR!CE"#RE destroE 0SCREE..ActiHeform.release E."PR!C E.""E4-.E Sample TR. / CATC0 1 :

@ m$tolo 211A B kumpulan prg kecil

27

//dian s 2112 //contoh sederhana pemakaian R5 ... CA C= L!CAL x as String8E as .um(er8$ as .um(er L!CAL oError AS Exception CLEAR x%'7' E%7 $%1 R5 $%xRE CA C= ! oError : oError.*essage =R!, CREA E!6JEC &'"ianException') E." R5 "E4-.E CLASS "ianException AS Exception #ser9alue % ;"ian's custom error handler; PR!CE"#RE -nit S R !4-LE&;Semua salah dan dustamu : ; R RA.S4!R*&"A E -*E&))> R C=R&7C)8;c:M"ianerrs.log;8. .) E."PR!C E.""E4-.E Sample TR. / CATC0 : //dian s 2112 //contoh sederhana pemakaian R5 ... CA C= 4-.ALL5 L!CAL x as String8E as .um(er8$ as .um(er L!CAL oError AS Exception8oError7 as Exception CLEAR x%'7' E%7 $%1 R5 $%xRE CA C= ! oError : oError.*essage 4-.ALL5 -4 oError.Error.o % 71K ?? !peratorZoperand tEpe mismatch : 'Pastikan data anda (enar D' //$ % Hal&x) R E E."-4 E." R5

@ m$tolo 211A B kumpulan prg kecil

22

Anda mungkin juga menyukai