Program Data Mahasiswa
Form:
Listing program:
Dim a, b As String
Dim c, d, e As Integer
Private Sub Command1_Click()
If Frame3.Left = 0 Then Timer2.Enabled = True
If Frame4.Left = 0 Then Timer4.Enabled = True
End Sub
Private Sub Command2_Click()
If Frame4.Left = 0 Then
Timer4.Enabled = True
If Frame3.Left = 5800 Then Timer1.Enabled = True
Else
If Frame3.Left = 5800 Then Timer1.Enabled = True
End If
Text1.SetFocus
End Sub
Private Sub Command3_Click()
If Frame3.Left = 0 Then Timer2.Enabled = True
If Frame4.Left = 5800 Then Timer3.Enabled = True
a = Text1.Text
Text6.Text = a
b = Text2.Text
Text7.Text = b
c = Val(Text3.Text)
Text8.Text = c
d = Val(Text4.Text)
Text9.Text = d
e = Val(Text5.Text)
Text10.Text = e
Text11.Text = 0.2 * Val(Text8.Text) + 0.3 * Val(Text9.Text) + 0.5 * Val(Text10.Text)
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub Form_Load()
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If IsNumeric(Text1.Text) Then
MsgBox "data yang ditampung hanya huruf", vbOKOnly, "sistem informasi"
Text2.Enabled = False
Text1.SetFocus
Text1.Text = ""
ElseIf Len(Text1.Text) >= 20 Then
MsgBox "Nama anda terlalu panjang", vbOKOnly, "sistem informasi"
Text2.Enabled = False
Text1.SetFocus
Text1.Text = ""
Else
Text2.Enabled = True
Text2.SetFocus
End If
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Not IsNumeric(Text2.Text) Then
MsgBox "data yang ditampung hanya angka", vbOKOnly, "sistem informasi"
Text3.Enabled = False
Text2.SetFocus
Text2.Text = ""
ElseIf Len(Text2.Text) <> 9 Then
MsgBox "NIM salah, masukkan kembali", vbOKOnly, "sistem informasi"
Text3.Enabled = False
Text2.SetFocus
Text2.Text = ""
Else
Text3.Enabled = True
Text3.SetFocus
End If
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Not IsNumeric(Text3.Text) Then
MsgBox "data yang ditampung hanya angka", vbOKOnly, "sistem informasi"
Text4.Enabled = False
Text3.SetFocus
Text3.Text = ""
ElseIf Len(Text3.Text) > 3 Then
MsgBox "Nilai salah, masukkan kembali", vbOKOnly, "sistem informasi"
Text4.Enabled = False
Text3.SetFocus
Text3.Text = ""
Else
Text4.Enabled = True
Text4.SetFocus
End If
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Not IsNumeric(Text4.Text) Then
MsgBox "data yang ditampung hanya angka", vbOKOnly, "sistem informasi"
Text5.Enabled = False
Text4.SetFocus
Text4.Text = ""
ElseIf Len(Text4.Text) > 3 Then
MsgBox "Nilai salah, masukkan kembali", vbOKOnly, "sistem informasi"
Text5.Enabled = False
Text4.SetFocus
Text4.Text = ""
Else
Text5.Enabled = True
Text5.SetFocus
End If
End If
End Sub
Private Sub Timer1_Timer()
Frame3.Left = Frame3.Left - 100
If Frame3.Left = 0 Then Timer1.Enabled = False
End Sub
Private Sub Timer2_Timer()
Frame3.Left = Frame3.Left + 100
If Frame3.Left = 5800 Then Timer2.Enabled = False
End Sub
Private Sub Timer3_Timer()
Frame4.Left = Frame4.Left - 100
If Frame4.Left = 0 Then Timer3.Enabled = False
End Sub
Private Sub Timer4_Timer()
Frame4.Left = Frame4.Left + 100
If Frame4.Left = 5800 Then Timer4.Enabled = False
End Sub
