Selasa, 14 November 2017

Tugas 6 Kalkulator Menggunakan Keypress

Tugas 6 Kalkulator Menggunakan Keypress

 Berikut Source Codenya:


Private Sub cmdhitung_Click()
txttotal1 = Val(txtn1) + (txtn2)
txttotal2 = Val(Txtn3) / (txtn4)
txttotal3 = Val(txtn5) - (txtn6)
txttotal4 = Val(txtn7) * (txtn8)
End Sub

Private Sub cmdbatal_click()
txtn1 = ""
txtn2 = ""
Txtn3 = ""
txtn4 = ""
txtn5 = ""
txtn6 = ""
txtn7 = ""
txtn8 = ""
txttotal1 = ""
txttotal2 = ""
txttotal4 = ""
txttotal3 = ""
txtn1.SetFocus
End Sub

Private Sub cmdlagi_Click()
txtn1 = ""
txtn2 = ""
Txtn3 = ""
txtn4 = ""
txtn5 = ""
txtn6 = ""
txtn7 = ""
txtn8 = ""
txttotal1 = ""
txttotal2 = ""
txttotal4 = ""
txttotal3 = ""
txtn1.SetFocus
End Sub

Private Sub cmdkeluar_click()
Unload Me
End Sub

Private Sub txtn1_keypress(keyascii As Integer)
If keyascii = 13 Then
txtn2.SetFocus
End If
End Sub

Private Sub txtn2_keypress(keyascii As Integer)
If keyascii = 13 Then
Txtn3.SetFocus
End If
End Sub

Private Sub txtn3_keypress(keyascii As Integer)
If keyascii = 13 Then
txtn4.SetFocus
End If
End Sub

Private Sub txtn4_keypress(keyascii As Integer)
If keyascii = 13 Then
txtn5.SetFocus
End If
End Sub

Private Sub txtn5_keypress(keyascii As Integer)
If keyascii = 13 Then
txtn6.SetFocus
End If
End Sub

Private Sub txtn6_keypress(keyascii As Integer)
If keyascii = 13 Then
txtn7.SetFocus
End If
End Sub

Private Sub txtn7_keypress(keyascii As Integer)
If keyascii = 13 Then
txtn8.SetFocus
End If
End Sub

Private Sub txtn8_keypress(keyascii As Integer)
If keyascii = 13 Then
txttotal1 = Val(txtn1) + (txtn2)
txttotal2 = Val(Txtn3) / (txtn4)
txttotal3 = Val(txtn5) - (txtn6)
txttotal4 = Val(txtn7) * (txtn8)
End If
End Sub

0 komentar:

Posting Komentar