|
-
Sep 10th, 2000, 07:49 AM
#1
Thread Starter
New Member
I am trying to enter a password. When you enter the first letter of the password wrong a label tells you Incorrect Password. It also works if you enter the first letter right and the second letter wrong. But if I enter the first two letters right and the third letter wrong it doesn't work. This is the code I used:
PrgmPassword = Text1
If Text1 = "Paula" Then
SetStringValue "HKEY_LOCAL_MACHINE", "String Value", PrgmPassword
Unload Me
Form2.Show
End If
If Text1 <> "Paula" Then
Label30 = clr
Label1.Caption = "Incorrect Password - Try Again"
End If
If Text1 = "" Then
Label1.Caption = clr
Label30 = "Please Insert Password"
End If
If Text1 < "Paula" Then
Label30 = "Please Insert Password"
Label1.Caption = clr
End If
Can anyone help me on this?
-
Sep 10th, 2000, 08:09 AM
#2
Ex-Super Mod'rater
Whats the point in that cos if it tells u after each letter if its right or wrong then people will find it easy to crack the password.
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Sep 11th, 2000, 06:54 AM
#3
Frenzied Member
He's right, this is a very insecure method of checking a password - are you just doing this as an exercise or are you planning on using it?
What does this line mean? :
If Text1 < "Paula" Then
I would use something like this:
Code:
If Left("Paula", Len(Text1.Text)) <> Text1.Text Then
'string entered is not the start of the string "Paula"
Harry.
"From one thing, know ten thousand things."
-
Sep 11th, 2000, 09:34 PM
#4
Lively Member
You can execute a test every time a letter is pressed by using the KeyPress Event
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Left("Paula", Len(Text1.Text)) <> Text1.Text Then
End Sub
-
Sep 12th, 2000, 12:09 PM
#5
Lively Member
if you want to do this, the best way is string paring
Text1_Change
Dim PW as string
Dim x as ling, y as long
PW = Password' whatever that may be
if Right$(PW, 1) = Right$(Text1.Text) Then
'Code for correct Paswword here
else
'Code for incorrect password here
end if
end sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|