VB.NET Small Problem.. - HotUKDeals
We use cookie files to improve site functionality and personalisation. By continuing to use HUKD, you accept our cookie and privacy policy.
Get the HUKD app free at Google Play

Search Error

An error occurred when searching, please try again!

Login / Sign UpSubmit

VB.NET Small Problem..

SAVE4IT Avatar
6y, 6m agoPosted 6 years, 6 months ago
Hi there,

I am currently working on a password system for an application I have developed.
The username: Admin
The Password: Password
And after 3 tries the application should close.

I have this and it works for the password, how would I insert the username too?

If txt_Password.Text <> "password" Then
Select Case Var1
Case Is <= 2
MsgBox("The password is incorrect", vbExclamation, "Incorrect Password")
Var1 = Var1 + 1
Case Else
MsgBox("You have entered the wrong password too many times, you are now locked out. Please contact your system administrator. The program will now terminate.", vbCritical, "Locked Out")
Me.Close()
End Select
Else
MsgBox("Password has been entered correctly.")
Main_Menu.Show()
Me.Hide()
End If


Any form of help would be really appreciated, thanks.
SAVE4IT Avatar
6y, 6m agoPosted 6 years, 6 months ago
Options

All Comments

(7) Jump to unreadPost a comment
Comments/page:
1 Like #1
Easiest way is to add "AND txt_Username.text <> "admin"" to your IF statement and change the user message to "Username or password is incorrect".
#2
Spriggan
add "AND txt_Username.text <> "admin"" to your IF statement


Yeah, I thought that would work too. Tried it before but it wasn't working :(

Thanks for that anyways :)
#3
It lets you in by typing the username correctly or typing the password correctly.

Im trying to get it so that it required both the username and password for entry
1 Like #4
SAVE4IT
Yeah, I thought that would work too. Tried it before but it wasn't working :(

Thanks for that anyways :)


Check the logic, it needs to be an OR not an AND. You want to stop them if the password OR the username are incorrect not just when they're both wrong :thumbsup:
#5
megalomaniac
Check the logic, it needs to be an OR not an AND. You want to stop them if the password OR the username are incorrect not just when they're both wrong :thumbsup:


Thanks a million :) Problem SOLVED.

Rep given
banned#6
where's VB1 when you need him. he knows all about the VB Net.
#7
DJ1
where's VB1 when you need him. he knows all about the VB Net.


I nearly read the title as VB1 = Small Problem.
I was going to tell the OP not to personally attack people! :thumbsup:

Post a Comment

You don't need an account to leave a comment. Just enter your email address. We'll keep it private.

...OR log in with your social account

...OR comment using your social account

Thanks for your comment! Keep it up!
We just need to have a quick look and it will be live soon.
The community is happy to hear your opinion! Keep contributing!