Anda di halaman 1dari 23

Private Sub Command1_Click() Dim P1, P2, P3, I1, I2, I3, m As Single ! 22" P1 ! al(t#t_l1$%e#t) P2 ! al(t#t_l2$%e#t) P3 !

al(t#t_l3$%e#t) I1 ! &ound(P1 ' , () I2 ! &ound(P2 ' , () I3 ! &ound(P3 ' , () I) I1 * I2 %+en I) I1 *! I3 %+en m ! I1 ,lse m ! I3 ,nd I) I) I2 *! I3 %+en m ! I2 ,lse m ! I3 ,nd I) ,nd I) -_1$.ackColor ! &/.(I1 ' m 0 211, ", ")

-_2$.ackColor ! &/.(I2 ' m 0 211, ", ") -_3$.ackColor ! &/.(I3 ' m 0 211, ", ") ,nd Sub

Private Sub C+eck1_Click() lbl_nama$2ont.old ! C+eck1$ alue ,nd Sub Private Sub C+eck2_Click() lbl_nama$2ontItalic ! C+eck2$ alue ,nd Sub Private Sub Command1_Click() lbl_nama$Ca3tion ! t#t_nama$%e#t ,nd Sub Private Sub Command3_Click() -ist1$AddItem Combo1$%e#t

,nd Sub Private Sub Command4_Click() -ist1$Clear -ist1$Inde# ,nd Sub Private Sub 2orm_-oad() Combo1$AddItem 5a6ura5 Combo1$AddItem 57d5 Combo1$AddItem 5&a8a5 Combo1$AddItem 59ueen5 ,nd Sub Private Sub :3tion1_Click() lbl_nama$2oreColor ! vb.lue ,nd Sub Private Sub :3tion2_Click() lbl_nama$2oreColor ! vb&ed ,nd Sub

Dim angka(1 %o 2) As Single Dim o3erator As String Private Sub cmdangka_Click(Inde# As Integer) %e#t1$%e#t ! %e#t1$%e#t ; cmdangka(Inde#)$Ca3tion ,nd Sub Private Sub cmd+a3us_Click() %e#t1$%e#t ,nd Sub Private Sub cmd+itung_Click() Dim +asil As Single I) %e#t1$%e#t ! 55 %+en ,#it Sub angka(2) ! CSng(%e#t1$%e#t) Select Case o3erator Case 5<5 +asil ! angka(1) < angka(2) Case 5=5 +asil ! angka(1) = angka(2)

Case 505 +asil ! angka(1) 0 angka(2) Case 5'5 +asil ! angka(1) ' angka(2) ,nd Select %e#t1$%e#t ! +asil ,nd Sub Private Sub cmdo3erator_Click(Inde# As Integer) I) %e#t1$%e#t ! 55 %+en ,#it Sub angka(1) ! CSng(%e#t1$%e#t) o3erator ! cmdo3erator(Inde#)$Ca3tion %e#t1$%e#t ! 55 ,nd Sub

>Deklarasi variable global Dim #3os As Single, ?3os As Single

Private Sub 2orm_-oad() >3inda+kan 3osisi roket ke tenga+ )orm #3os ! (7e$Scale@idt+ = Pic&oket$@idt+) ' 2 ?3os ! (7e$ScaleAeig+t = Pic&oket$Aeig+t) ' 2 Pic&oket$7ove #3os, ?3os ,nd Sub Private Sub )orm_ke?DoBn(Ce?Code As Integer, S+i)t As Integer) >cek tombol ke?board ?ang ditekan Select Case Ce?Code Case vbCe?-e)t >%ombol 3ana+ kiri Call &oketCekiri Case vbCe?&ig+t >%ombol 3ana+ kanan Call &oketCeCanan ,nd Select ,nd Sub Private Sub )orm_Ce?D3(Ce?Code As Integer, S+i)t As Integer) >Cek tombol ke?board ?ang ditekan Select Case Ce?Code Case vbCe?D3 >%ombol 3ana+ atas Call &oketCeatas Case vbCe?DoBn >tombol 3ana+ baBa+ Call &oketCebaBa+ ,nd Select ,nd Sub Private Sub )orm_ke?Press(Ce?Ascii As Integer) >Cek %ombol ke?board ?ang ditekan I) Ce?Ascii ! vbCe?,sca3e %+en >%ombol ,sca3e I) 7sg.o#(5%utu3 3rogram E5, vb9uestion < vbFesGo, _ 7e$Ca3tion) ! vbFes %+en Dnload 7e ,nd I) ,nd Sub Private Sub &oketCekiri() #3os ! #3os = 1" >/eser ke kiri 1" 3i#el I) #3os H " %+en >Cek bila meleBati batas kiri #3os ! " ,nd I) Pic&oket$7ove #3os >Pinda+kan 3osisi roket ,nd Sub Private Sub &oketCeCanan() #3os ! #3os < 1" >/eser ke kanan 1" 3i#el

I) #3os * 7e$Scale@idt+ = Pic&oket$@idt+ %+en #3os ! 7e$Scale@idt+ = Pic&oket$@idt+ ,nd I) Pic&oket$7ove #3os >Pinda+kan 3osisi rocket ,nd Sub

>Cek bila meleBati batas kanan

Private Sub &oketCeatas() ?3os ! ?3os = 1" >/eser ke atas 1" 3i#el I) ?3os H " %+en >Cek bila meleBati batas atas ?3os ! " ,nd I) Pic&oket$7ove #3os, ?3os >Pinda+kan 3osisi rocket ,nd Sub Private Sub &oketCebaBa+() ?3os ! ?3os < 1" >/eser ke baBa+ 1" 3i#el I) ?3os * 7e$ScaleAeig+t = Pic&oket$Aeig+t %+en >Cek bila meleBati batas baBa+ ?3os ! 7e$ScaleAeig+t = Pic&oket$Aeig+t ,nd I) Pic&oket$7ove #3os, ?3os >3inda+kan 3osisi roket ,nd Sub Private Sub Pic&oket_Click() ,nd Sub

Private Sub Command1_Click() Dim i As Double Dim o As String i ! al(t#t_in3ut$%e#t) I) i H 3$1 %+en o ! 5D5 ,lseI) i H 1$1 %+en o ! 5C5 ,lseI) i H I$1 %+en o ! 5.5 ,lse o ! 5A5 ,nd I) lbl_+asil$Ca3tion ! o ,nd Sub Private Sub Command2_Click() I) %e#t1$%e#t ! 5A5 %+en Image1$ isible ! %rue Image1$Picture ! -oadPicture(5CJKA$LP/5) ,lseI) %e#t1$%e#t ! 5.5 %+en

Image1$ isible ! %rue Image1$Picture ! -oadPicture(5CJK.$LP/5) ,lse %e#t1$%e#t ! 5C5 Image1$ isible ! %rue Image2$ isible ! %rue Image1$Picture ! -oadPicture(5CJKA$LP/5) Image2$Picture ! -oadPicture(5CJK.$LP/5) ,nd I) ,nd Sub

Private Sub list1_Drag:ver(Source As Control, M As Single, F As Single, state As Integer) 7e$Cls 7e$Print 5Source J 5 ; Source$Game

7e$Print 5M,FJ 5 ; M ; 5,5 ; F 7e$Print 5StateJ 5 ; state ,nd Sub Private Sub list1_DragDro3(Source As Control, M As Single, F As Single) I) Source$Game ! 5%e#t15 %+en -ist1$AddItem %e#t1$%e#t ,nd I) 7e$Cls ,nd Sub Private Sub 2orm_Drag:ver(Source As Control, M As Single, F As Single, state As Integer) 7e$Cls ,nd Sub Private Sub 2orm_DragDro3(Source As Control, M As Single, F As Single) 7e$Cls ,nd Sub

Dim test2 As Integer Private Sub Command1_Click() Dim test2 As String test1 ! 5nusantara5 -abel1$Ca3tion ! test1 -abel2$Ca3tion ! test2 -abel3$Ca3tion ! test3 ,nd Sub Private Sub Command2_Click() test2 ! 1" -abel1$Ca3tion ! test1 -abel2$Ca3tion ! test2 -abel3$Ca3tion ! test3 ,nd Sub Private Sub Command3_Click() Const test3 As Single ! N"$11 tes3 ! 1"$22 -abel1$Ca3tion ! test1 -abel2$Ca3tion ! test2 -abel3$Ca3tion ! test3 ,nd Sub Private Sub 2orm_-oad() ,nd Sub

Dim var1 As Single, var2 As Single Dim +asil As Single Private Sub 2orm_-oad() ,nd Sub Private Sub :3tion1_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! var1 < var2 -abel3$Ca3tion ! +asil ,nd Sub Private Sub :3tion1"_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! (var1 *! var2) -abel3$Ca3tion ! 2ormat(+asil, 5true')alse5) ,nd Sub Private Sub :3tion11_Click()

var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! (var1 H! var2) -abel3$Ca3tion ! 2ormat(+asil, 5true')alse5) ,nd Sub Private Sub :3tion12_Click() var1 ! II)(%e#t1$%e#t ! 5true5, =1, ") +asil ! Got (var1) -abel3$Ca3tion ! 2ormat(+asil, 5true')alse5) ,nd Sub Private Sub :3tion13_Click() var1 ! II)(%e#t1$%e#t ! 5true5, =1, ") var2 ! II)(%e#t2$%e#t ! 5true5, =1, ") +asil ! (var1 :r var2) -abel3$Ca3tion ! 2ormat(+asil, 5true')alse5) ,nd Sub Private Sub :3tion14_Click() var1 ! II)(%e#t1$%e#t ! 5true5, =1, ") var2 ! II)(%e#t2$%e#t ! 5true5, =1, ") +asil ! (var1 And var2) -abel3$Ca3tion ! 2ormat(+asil, 5true')alse5) ,nd Sub Private Sub :3tion2_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! var1 = var2 -abel3$Ca3tion ! +asil ,nd Sub Private Sub :3tion3_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! var1 0 var2 -abel3$Ca3tion ! +asil ,nd Sub Private Sub :3tion4_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! var1 ' var2 -abel3$Ca3tion ! +asil ,nd Sub

Private Sub :3tion1_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! var1 ; var2 -abel3$Ca3tion ! +asil ,nd Sub Private Sub :3tion(_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! (var1 * var2) >-abel3$Ca3tion ! +asil -abel3$Ca3tion ! 2ormat(+asil, 5true')alse5) ,nd Sub Private Sub :3tionI_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! (var1 H var2) -abel3$Ca3tion ! 2ormat(+asil, 5true')alse5) ,nd Sub Private Sub :3tionO_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! (var1 ! var2) -abel3$Ca3tion ! 2ormat(+asil, 5true')alse5) ,nd Sub Private Sub :3tionN_Click() var1 ! %e#t1$%e#t var2 ! %e#t2$%e#t +asil ! (var1 H* var2) -abel3$Ca3tion ! 2ormat(+asil, 5true')alse5) ,nd Sub

Private Sub Command1_Click() I) -Case(%e#t1$%e#t) ! 5nusantara5 %+en Image1$ isible ! %rue %e#t1$,nabled ! 2alse Command1$,nabled ! 2alse ,lseI) -abel2$Ca3tion *! 3 %+en 7sg.o# 5+abis5 ,lse 7sg.o# 53asBordn?a sala+5 -abel2 ! -abel2$Ca3tion < 1 Command1$,nabled ! %rue ,nd I) ,nd Sub

Private Sub Command1_Click() Dim +rg As Currenc?, total As Currenc? Dim 8ml+ As Integer Dim dskn As Single Dim satuan As String I) -ist1$%e#t ! 55 %+en 7sg.o# 5anda belum memili+ barangPP5 -ist1$-istInde# ! " ,#it Sub ,nd I) Select Case -ist1$%e#t Case 5disket5 +arga ! 31""" satuan ! 5.o#5 Case 5buku5 +arga ! 2"""" satuan ! 5lusin5 Case 5kertas5 +arga ! 21""" satuan ! 5&im5 Case 5Pul3en5 +arga ! 1""""

satuan ! 5Pak5 ,nd Select lbl_brg$Ca3tion ! 5barangJ5 ; -ist1$%e#t lbl_+rg$Ca3tion ! 5+argaJ5 ; 2ormat(+arga, 5Currenc?5) ; 5'5 ; satuan lbl_8ml+$Ca3tion ! 5Lml+J5 ; %e#t1$%e#t ; 5 5 ; satuan 8ml+ ! %e#t1$%e#t Select Case 8ml+ Case Is H 1" diskon ! " Case 1" %o 2" diskon ! "$11 Case ,lse diskon ! "$2 ,nd Select total ! 8ml+ 0 (+arga 0 (1 = diskon)) lbl_dskn$Ca3tion ! 5diskonJ5 ; 2ormat(diskon, 5"Q5) lbl_tot$Ca3tion ! 5total ba?arJ5 ; 2ormat(total, 5currenc?5) ,nd Sub Private Sub 2orm_-oad() -ist1$AddItem 5disket5 -ist1$AddItem 5buku5 -ist1$AddItem 5kertas5 -ist1$AddItem 53ul3en5 ,nd Sub

Private Sub Command1_Click() Dim )ilename As String Image1$Picture ! Got+ing )ilename ! In3ut.o#(5ketikkan 3at+ dan nama )ile gambarJ5, 5o3en 3icture )ile5, )ilename) I) )ilename H* 55 %+en Image1$Picture ! -oadPicture()ilename) ,nd I) ,nd Sub

Private Sub %ulisteks(teks As String, :3tional Barna As ColorConstants ! vb7agenta) @it+ -abel1 $Ca3tion ! teks $2oreColor ! Barna ,nd @it+ ,nd Sub Private 2unction 8umla+angka() As String Dim angka1 As String, angka2 As String Dim +asil As Single angka1 ! In3ut.o#(5tulis angka 1 J5, 58umla+ angka5) angka2 ! In3ut.o#(5tulis angka 2 J5, 58umla+ angka5) I) angka1 H* 55 And angka2 H* 55 %+en +asil ! CSng(angka1) < CSng(angka2) 8umla+angka ! CStr(+asil) ,nd I) ,nd 2unction

Private Sub Command1_Click() Call %ulisteks(5+ello5, vb&ed) ,nd Sub Private Sub Command2_Click() -abel1$Ca3tion ! 58umla+ !5 ; 8umla+angka() ,nd Sub Private Sub 2orm_-oad() ,nd Sub Private Sub -abel1_DblClick() Call %ulisteks(5+ello5) ,nd Sub

Dim i As Integer Private Sub Command1_Click() -ist1$Clear

2or i ! 1 %o 1"" -ist1$AddItem 5angka5 ; i I) i ! 1" %+en ,#it 2or Ge#t ,nd Sub Private Sub Command2_Click() -ist1$Clear 2or i ! 1"" %o 1 Ste3 =2 -ist1$AddItem 5angka5 ; i Ge#t i ,nd Sub Private Sub Command3_Click() -ist1$Clear i ! Asc(5A5) Do Dntil i * Asc(5R5) -ist1$AddItem 5+uru)5 ; C+r(i) I) C+r(i) ! 5m5 %+en ,#it Do i!i<1 -oo3 ,nd Sub Private Sub Command4_Click() -ist1$Clear i ! Asc(5R5) Do @+ile i *! Asc(5A5) -ist1$AddItem 5+uru)5 ; C+r(i) i!i=1 -oo3 ,nd Sub Private Sub 2orm_-oad() ,nd Sub

Dim namasisBa() As String Private Sub Command1_Click() Dim no As Integer, i As Integer no ! CInt(Combo1$%e#t) namasisBa(no) ! In3ut.o#(5tuliskan nama sisBa no J 5 ; no, 5 in3utnama sisBa5) I) namasisBa(no) H* 55 %+en -ist1$Clear 2or i ! 1 %o D.ound(namasisBa) -ist1$AddItem 5namasisBa (5 ; i ; 5)!5 ; namasisBa(i) Ge#t i ,nd I)

,nd Sub Private Sub Command2_Click() Dim num As Integer, i As Integer I) Got IsGumeric(%e#t1$%e#t) %+en ,#it Sub num ! CInt(%e#t1$%e#t)

&eDim namasisBa(1 %o num) Combo1$Clear -ist1$Clear 2or i ! 1 %o D.ound(namasisBa) Combo1$AddItem i -ist1$AddItem 5namasisBa(5 ; i ; 5)!5 ; namasisBa(i) Ge#t i Combo1$-istInde# ! " ,nd Sub Private Sub 2orm_-oad() Dim i As Integer &eDim namasisBa(1 %o 1) 2or i ! " %o 1 Combo1$AddItem i Ge#t i Combo1$-istInde# ! " ,nd Sub