PENJUMLAHAN WITH KEYPRESS
Private Sub cmdhitung_Click()
txttotal = Val(txtn1) + Val(txtn2)
End Sub
Private Sub cmdkeluar_Click()
Unload Me
End Sub
Private Sub cmdlagi_Click()
txtn1 = ""
txtn2 = ""
txttotal = ""
txttotal.SetFocus
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
txttotal = Val(txtn1) + Val(txtn2)
End If
End Sub
Private Sub cmdhitung_Click()
txttotal = Val(txtn1) + Val(txtn2)
End Sub
Private Sub cmdkeluar_Click()
Unload Me
End Sub
Private Sub cmdlagi_Click()
txtn1 = ""
txtn2 = ""
txttotal = ""
txttotal.SetFocus
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
txttotal = Val(txtn1) + Val(txtn2)
End If
End Sub
Komentar
Posting Komentar