3x login error will terminate a program

Asked By 25 points N/A Posted on -
qa-featured

I want to code a validation in VB6.0 login form. I want the program to terminate when the user entered a wrong username or password three times. In addition, the program will return an error message stating "You are not a valid user. The Program will be terminated" . All I need is a sample code for this. Thanks

SHARE
Answered By 0 points N/A #103651

3x login error will terminate a program

qa-featured
dim count as integer
private sub form_load()
count=0
end sub
private sub cmdlogin_click()
if <’txtusername’> < >  <’uname’> then        // If the username does not match the required username,
count = count + 1
msgbox(“Entered username & password is invalid”)
If count >= 3 then
unload me
end if
end sub
 
The program takes a global variable ‘count’. the form_load procedure initializes the global variable.
on unmatched usernames, the count variable increments and when it reaches a klimit the form is unloaded. A message box is displayed for entering wrong password.
Replace the txtusername.text  with the entered string and the uname with the list if usernames (one at a time). use a loop for the with the entered string and the uname with the list if usernames (one at a time). use a loop for the with the entered string and the uname with the list if usernames (one at a time). use a loop for the with the entered string and the uname with the list if usernames (one at a time). use a loop for the forloop  if you have many usernames.
Thanks.

Related Questions