Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim user As String
- Private Sub cmbusers_Click()
- user = cmbusers.Text
- txtpassword.SetFocus
- End Sub
- Private Sub cmdlogin_Click()
- On Error Resume Next
- txtpassword.Text = LCase(txtpassword) 'Removes Case Sensitivity
- If user = "Administrator" And txtpassword = "password" Then
- tmrcountdown.Enabled = False
- Me.Hide
- frmmenu.Show
- End If
- If user = "Guest" And txtpassword = "password" Then
- tmrcountdown.Enabled = False
- Me.Hide
- frmmenu.Show
- frmmenu.cmd2.Enabled = False 'Guest user rights implemented
- End If
- End Sub
- Private Sub txtpassword_KeyPress(KeyAscii As Integer) 'Allows user to press 'Enter' to log in
- If KeyAscii = 13 Then
- Call cmdlogin_Click
- End If
- End Sub
- Private Sub Form_Load()
- counter = 20
- tmrcountdown.Enabled = True
- cmbusers.AddItem "Administrator"
- cmbusers.AddItem "Guest"
- frmlogin.BackColor = vbWhite
- End Sub
- Private Sub tmrcountdown_timer() '20 second timer
- counter = counter - 1
- lblcountdown.Caption = counter & " seconds remaining !!! "
- If counter = 19 Then
- Img1.Visible = True
- End If
- If counter = 18 Then
- Img1.Visible = False
- Img2.Visible = True
- End If
- If counter = 17 Then
- Img2.Visible = False
- Img3.Visible = True
- End If
- If counter = 16 Then
- Img3.Visible = False
- Img4.Visible = True
- End If
- If counter = 15 Then
- Img4.Visible = False
- Img5.Visible = True
- End If
- If counter = 14 Then
- Img5.Visible = False
- Img6.Visible = True
- End If
- If counter = 13 Then
- Img6.Visible = False
- Img7.Visible = True
- End If
- If counter = 12 Then
- Img7.Visible = False
- Img8.Visible = True
- End If
- If counter = 11 Then
- Img8.Visible = False
- Img9.Visible = True
- End If
- If counter = 10 Then
- Img9.Visible = False
- Img10.Visible = True
- End If
- If counter = 0 Then
- lblcountdown.Caption = " Time's up !!!"
- MsgBox "Time's up !!!"
- End
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement