Tugas 6 Kalkulator Menggunakan Keypress
Source kode :
Private Sub cmdhitung_Click()
txttotal1 = Val(txtnilai1) +
(txtnilai2)
txttotal2 = Val(txtnilai3) /
(txtnilai4)
txttotal3 = Val(txtnilai5) -
(txtnilai6)
txttotal4 = Val(txtnilai7) * (txtnilai8)
End Sub
Private Sub cmdbatal_click()
txtnilai1 = ""
txtnilai2 = ""
txtnilai3 = ""
txtnilai4 = ""
txtnilai5 = ""
txtnilai6 = ""
txtnilai7 = ""
txtnilai8 = ""
txttotal1 = ""
txttotal2 = ""
txttotal4 = ""
txttotal3 = ""
txtnilai1.SetFocus
End Sub
Private Sub cmdlagi_Click()
txtnilai1 = ""
txtnilai2 = ""
txtnilai3 = ""
txtnilai4 = ""
txtnilai5 = ""
txtnilai6 = ""
txtnilai7 = ""
txtnilai8 = ""
txttotal1 = ""
txttotal2 = ""
txttotal4 = ""
txttotal3 = ""
txtnilai1.SetFocus
End Sub
Private Sub cmdkeluar_click()
Unload Me
End Sub
Private Sub
txtnilai1_keypress(keyascii As Integer)
If keyascii = 13 Then
txtnilai2.SetFocus
End If
End Sub
Private Sub
txtnilai2_keypress(keyascii As Integer)
If keyascii = 13 Then
txtnilai3.SetFocus
End If
End Sub
Private Sub
txtnilai3_keypress(keyascii As Integer)
If keyascii = 13 Then
txtnilai4.SetFocus
End If
End Sub
Private Sub
txtnilai4_keypress(keyascii As Integer)
If keyascii = 13 Then
txtnilai5.SetFocus
End If
End Sub
Private Sub
txtnilai5_keypress(keyascii As Integer)
If keyascii = 13 Then
txtnilai6.SetFocus
End If
End Sub
Private Sub
txtnilai6_keypress(keyascii As Integer)
If keyascii = 13 Then
txtnilai7.SetFocus
End If
End Sub
Private Sub
txtnilai7_keypress(keyascii As Integer)
If keyascii = 13 Then
txtnilai8.SetFocus
End If
End Sub
Private Sub
txtnilai8_keypress(keyascii As Integer)
If keyascii = 13 Then
txttotal1 = Val(txtnilai1) +
(txtnilai2)
txttotal2 = Val(txtnilai3) /
(txtnilai4)
txttotal3 = Val(txtnilai5) -
(txtnilai6)
txttotal4 = Val(txtnilai7) * (txtnilai8)
End If
End Sub
Tidak ada komentar:
Posting Komentar