
Baiklah gak perlu lama2, langsung aja buat sebuah form yang terdiri dari 2 label untuk user dan password, 2 textbox juga untuk user dan password, 2 combobox untuk tombol Log In dan Keluar, 1 timmer, dan 1 progressbar. Kemudian buat lagi 1 form yang kita gunakan untuk form menu utama. berikut source codenya :
Private Sub Cmd_log_Click()
If Text_user = "" And Text_pass = "" Then
MsgBox ("Isi dulu User dan Passwordnya...!!!"), vbInformation, "Sory....."
Text_user.Text = ""
Text_pass.Text = ""
Text_user.SetFocus
ElseIf Text_user = "" Then
MsgBox ("Isi dulu Usernya...!!!"), vbInformation, "Sory....."
Text_user.Text = ""
Text_user.SetFocus
ElseIf Text_pass = "" Then
MsgBox ("Isi dulu Passwordnya...!!!"), vbInformation, "Sory....."
Text_pass.Text = ""
Text_pass.SetFocus
ElseIf Text_user = "ADMIN" And Text_pass = "1234" Then
MsgBox ("Selemat Datang..."), vbOKOnly, "Welcome"
Timer1.Enabled = True
ElseIf Text_user <> "ADMIN" Then
MsgBox ("User salah..!!!!"), vbInformation, "Ooops..."
Text_user.Text = ""
Text_user.SetFocus
ElseIf Text_pass <> "1234" Then
MsgBox ("Password salah..!!!!"), vbInformation, "Ooops..."
Text_pass.Text = ""
Text_pass.SetFocus
Else
MsgBox ("User dan password salah..."), vbInformation, "Ooops..."
Text_user.Text = ""
Text_pass.Text = ""
Text_user.SetFocus
End If
End Sub
Private Sub Form_Activate()
Text_user.SetFocus
End Sub
Private Sub Form_Load()
Text_user = ""
Text_pass = ""
Text_pass.PasswordChar = "*"
ProgressBar1.Min = 0
ProgressBar1.max = 1000
Timer1.Enabled = False
End Sub
Private Sub Text_pass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Cmd_log.SetFocus
End Sub
Private Sub Text_user_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text_pass.SetFocus
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
For i = ProgressBar1.Min To ProgressBar1.max
ProgressBar1.Value = i
If ProgressBar1.Value = 1000 Then
Unload Me
menu.Show
End If
Next
End Sub
If Text_user = "" And Text_pass = "" Then
MsgBox ("Isi dulu User dan Passwordnya...!!!"), vbInformation, "Sory....."
Text_user.Text = ""
Text_pass.Text = ""
Text_user.SetFocus
ElseIf Text_user = "" Then
MsgBox ("Isi dulu Usernya...!!!"), vbInformation, "Sory....."
Text_user.Text = ""
Text_user.SetFocus
ElseIf Text_pass = "" Then
MsgBox ("Isi dulu Passwordnya...!!!"), vbInformation, "Sory....."
Text_pass.Text = ""
Text_pass.SetFocus
ElseIf Text_user = "ADMIN" And Text_pass = "1234" Then
MsgBox ("Selemat Datang..."), vbOKOnly, "Welcome"
Timer1.Enabled = True
ElseIf Text_user <> "ADMIN" Then
MsgBox ("User salah..!!!!"), vbInformation, "Ooops..."
Text_user.Text = ""
Text_user.SetFocus
ElseIf Text_pass <> "1234" Then
MsgBox ("Password salah..!!!!"), vbInformation, "Ooops..."
Text_pass.Text = ""
Text_pass.SetFocus
Else
MsgBox ("User dan password salah..."), vbInformation, "Ooops..."
Text_user.Text = ""
Text_pass.Text = ""
Text_user.SetFocus
End If
End Sub
Private Sub Form_Activate()
Text_user.SetFocus
End Sub
Private Sub Form_Load()
Text_user = ""
Text_pass = ""
Text_pass.PasswordChar = "*"
ProgressBar1.Min = 0
ProgressBar1.max = 1000
Timer1.Enabled = False
End Sub
Private Sub Text_pass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Cmd_log.SetFocus
End Sub
Private Sub Text_user_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text_pass.SetFocus
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
For i = ProgressBar1.Min To ProgressBar1.max
ProgressBar1.Value = i
If ProgressBar1.Value = 1000 Then
Unload Me
menu.Show
End If
Next
End Sub
0 komentar:
Post a Comment