Ne ada tutorial VB kalkulator.....
Script Code :
Private Sub Form_Load()
Call AddData
End Sub
Private Sub Combo1_Change()
Private Sub AddData()
With Combo1
Combo1.Clear
Combo1.AddItem "Perkalian"
Combo1.AddItem "Pengurangan"
Combo1.AddItem "Pembagian"
Combo1.AddItem "Perpangkatan"
Combo1.AddItem "Penjumlahan"
Combo1.AddItem "Akar"
End With
End Sub
Private Sub cmdHitung_Click()
If Combo1 = "Perkalian" Then Label1.Caption = "X"
If Combo1 = "Perkalian" Then Text3.Text = Val(Text1.Text) * Val(Text2.Text)
If Combo1 = "Pengurangan" Then Label1.Caption = "-"
If Combo1 = "Pengurangan" Then Text3.Text = Val(Text1.Text) - Val(Text2.Text)
If Combo1 = "Pembagian" Then Label1.Caption = "/"
If Combo1 = "Pembagian" Then Text3.Text = Val(Text1.Text) / Val(Text2.Text)
If Combo1 = "Perpangkatan" Then Label1.Caption = "^"
If Combo1 = "Perpangkatan" Then Text3.Text = Val(Text1.Text) ^ Val(Text2.Text)
If Combo1 = "Penjumlahan" Then Label1.Caption = "+"
If Combo1 = "Penjumlahan" Then Text3.Text = Val(Text1.Text) + Val(Text2.Text)
If Combo1 = "Akar" Then Label1.Caption = ""
If Combo1 = "Akar" Then Text3.Text = Val(Text1.Text) ^ 0.5
End Sub
Private Sub cmdPesan_Click()
MsgBox "Terima Kasih (^_^)....", vbExclamation, "Pesanku"
End Sub
Private Sub cmdReset_Click()
Label1.Caption = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub cmdExit_Click()
End
End Sub
Selamat Mencoba......
0 komentar:
Posting Komentar