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
Carpe per diem
3,606 posts since Aug 2010
Reputation Points: 561
Solved Threads: 450
Skill Endorsements: 32
The last poster (whose handle I can't spell this early before my coffee) is right. You'd have to preserve the data somehow in case the user just restarts the app. This could be through a database, file, or through My.Settings variables.
Reverend Jim
Carpe per diem
3,606 posts since Aug 2010
Reputation Points: 561
Solved Threads: 450
Skill Endorsements: 32
Question Answered as of 1 Year Ago by
M.Waqas Aslam
and
Reverend Jim