Penjumlahan With KeyPress
Private Sub Cmdhitung_Click()
txttotal = Val(txtnilai1) + Val(txtnilai2)
End Sub
Private Sub Cmdkeluar_Click()
Unload Me
End Sub
Private Sub Cmdlagi_Click()
txtnilai1 = ""
txtnilai2 = ""
txttotal = ""
txtnilai1.SetFocus
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
txttotal = Val(txtnilai1) + (txtnilai2)
End If
End Sub
Komentar
Posting Komentar