You could declare some variables with class scope such as
Dim numFailed As Integer 'number of consecutive failed login attempts
Dim lastAttempt As Date 'date & time of last login attempt
Dim lastUser As String 'name of last user to try to login In the form load event, initialize numFailed to 0 and lastUser to "". When the user tries to login, the logic would be as follows
Dim canLogin as Boolean = True
if currentUser = lastUser Then
if numFailed = 3 Then
if less than 10 minutes since lastAttempt Then
canLogin = False
end if
end if
end if
if canLogin then
if Login(currentUser) Then
numFailed = 0
else
numFailed += 1
end if
lastUser = currentUser
lastAttempt = Now()
else
MsgBox("please wait a few minutes and try again"
end if Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159