Advertisement
Guest User

Form Login

a guest
Dec 1st, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. Dim user As String
  2.  
  3. Private Sub cmbusers_Click()
  4. user = cmbusers.Text
  5. txtpassword.SetFocus
  6. End Sub
  7.  
  8. Private Sub cmdlogin_Click()
  9. On Error Resume Next
  10. txtpassword.Text = LCase(txtpassword) 'Removes Case Sensitivity
  11. If user = "Administrator" And txtpassword = "password" Then
  12. tmrcountdown.Enabled = False
  13. Me.Hide
  14. frmmenu.Show
  15. End If
  16.  
  17. If user = "Guest" And txtpassword = "password" Then
  18. tmrcountdown.Enabled = False
  19. Me.Hide
  20. frmmenu.Show
  21. frmmenu.cmd2.Enabled = False 'Guest user rights implemented
  22. End If
  23.  
  24. End Sub
  25.  
  26. Private Sub txtpassword_KeyPress(KeyAscii As Integer) 'Allows user to press 'Enter' to log in
  27. If KeyAscii = 13 Then
  28. Call cmdlogin_Click
  29. End If
  30. End Sub
  31.  
  32.  
  33. Private Sub Form_Load()
  34. counter = 20
  35. tmrcountdown.Enabled = True
  36.  
  37. cmbusers.AddItem "Administrator"
  38. cmbusers.AddItem "Guest"
  39. frmlogin.BackColor = vbWhite
  40.  
  41. End Sub
  42.  
  43. Private Sub tmrcountdown_timer() '20 second timer
  44. counter = counter - 1
  45. lblcountdown.Caption = counter & " seconds remaining !!! "
  46.  
  47. If counter = 19 Then
  48. Img1.Visible = True
  49. End If
  50.  
  51. If counter = 18 Then
  52. Img1.Visible = False
  53. Img2.Visible = True
  54. End If
  55.  
  56. If counter = 17 Then
  57. Img2.Visible = False
  58. Img3.Visible = True
  59. End If
  60.  
  61. If counter = 16 Then
  62. Img3.Visible = False
  63. Img4.Visible = True
  64. End If
  65.  
  66. If counter = 15 Then
  67. Img4.Visible = False
  68. Img5.Visible = True
  69. End If
  70.  
  71. If counter = 14 Then
  72. Img5.Visible = False
  73. Img6.Visible = True
  74. End If
  75.  
  76. If counter = 13 Then
  77. Img6.Visible = False
  78. Img7.Visible = True
  79. End If
  80.  
  81. If counter = 12 Then
  82. Img7.Visible = False
  83. Img8.Visible = True
  84. End If
  85.  
  86. If counter = 11 Then
  87. Img8.Visible = False
  88. Img9.Visible = True
  89. End If
  90.  
  91. If counter = 10 Then
  92. Img9.Visible = False
  93. Img10.Visible = True
  94. End If
  95.  
  96. If counter = 0 Then
  97. lblcountdown.Caption = " Time's up !!!"
  98. MsgBox "Time's up !!!"
  99. End
  100. End If
  101.  
  102.  
  103. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement