tugas 2.8 pakai keypress
tugas 2.8
Private Sub quit_Click()
Unload Me
End Sub
Private Sub txtnq_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnt.SetFocus
End If
End Sub
Private Sub txtnt_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtut.SetFocus
End If
End Sub
Private Sub txtua_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtna.SetFocus
Dim na As Integer
Dim hm As String
quis = Val(txtnq.Text)
tugas = Val(txtnt.Text)
uts = Val(txtut.Text)
uas = Val(txtua.Text)
na = (quis + tugas + uts + uas) / 4
txtna.Text = na
Select Case txtna.Text
Case Is > 80
hm = "A"
Case Is > 70
hm = "B"
Case Is > 60
hm = "C"
Case Is > 50
hm = "D"
Case Is < 50
hm = "E"
End Select
txthm.Text = hm
End If
End Sub
Private Sub txtut_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtua.SetFocus
End If
End Sub
Unload Me
End Sub
Private Sub txtnq_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnt.SetFocus
End If
End Sub
Private Sub txtnt_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtut.SetFocus
End If
End Sub
Private Sub txtua_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtna.SetFocus
Dim na As Integer
Dim hm As String
quis = Val(txtnq.Text)
tugas = Val(txtnt.Text)
uts = Val(txtut.Text)
uas = Val(txtua.Text)
na = (quis + tugas + uts + uas) / 4
txtna.Text = na
Select Case txtna.Text
Case Is > 80
hm = "A"
Case Is > 70
hm = "B"
Case Is > 60
hm = "C"
Case Is > 50
hm = "D"
Case Is < 50
hm = "E"
End Select
txthm.Text = hm
End If
End Sub
Private Sub txtut_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtua.SetFocus
End If
End Sub
Komentar
Posting Komentar