PDA

Click to See Complete Forum and Search --> : Passwords/Usernames in the registry


Tobyn
Nov 4th, 1999, 09:11 PM
Hey,
heres my code, i need a little help please


Dim CountClick As Integer
Dim X As Variant
Private Sub cmdOK_Click()
X = 1 Or "2" Or 3 Or 4 Or 5 Or 6 Or 7 Or 8 Or 9 Or 10
Dim bLoggedin As Boolean

If txtuser = GetSetting(App.Title, "Setup", "user1" = txtuser) Then
If txtpass = GetSetting(App.Title, "Setup", "pass1" = txtpass) Then
bLoggedin = True
ElseIf txtuser = GetSetting(App.Title, "Setup", "user2" = txtuser) Then
ElseIf txtpass = GetSetting(App.Title, "Setup", "pass2" = txtpass) Then
bLoggedin = True
ElseIf txtuser = GetSetting(App.Title, "Setup", "User3" = txtuser) Then
ElseIf txtpass = GetSetting(App.Title, "Setup", "Pass3" = txtpass) Then
bLoggedin = True
ElseIf txtuser = GetSetting(App.Title, "Setup", "user4" = txtuser) Then
ElseIf txtpass = GetSetting(App.Title, "Setup", "pass4" = txtpass) Then
bLoggedin = True
ElseIf txtuser = GetSetting(App.Title, "Setup", "user5" = txtuser) Then
ElseIf txtpass = GetSetting(App.Title, "Setup", "pass5" = txtpass) Then
bLoggedin = True
ElseIf txtuser = GetSetting(App.Title, "Setup", "user6" = txtuser) Then
ElseIf txtpass = GetSetting(App.Title, "Setup", "pass6" = txtpass) Then
bLoggedin = True
ElseIf txtuser = GetSetting(App.Title, "Setup", "user7" = txtuser) Then
ElseIf txtpass = GetSetting(App.Title, "Setup", "pass7" = txtpass) Then
bLoggedin = True
ElseIf txtuser = GetSetting(App.Title, "Setup", "user8" = txtuser) Then
ElseIf txtpass = GetSetting(App.Title, "Setup", "pass8" = txtpass) Then
bLoggedin = True
Else
bLoggedin = False
End If
Else
bLoggedin = False
End If
MsgBox IIf(bLoggedin, "Login Successful", "Login Failed")

End Sub


Private Sub Command1_Click()
CountClick = Label1.Caption + 1
SaveSetting App.Title, "Setup", "User" & CountClick, Text1
SaveSetting App.Title, "Setup", "Pass" & CountClick, Text2
Label1.Caption = CountClick
Label2.Caption = CountClick
End Sub
Private Sub exit_Click()
SaveSetting App.Title, "setup", "User#", CountClick
SaveSetting App.Title, "setup", "Pass#", CountClick
End
End Sub

Private Sub Form_Load()
Label1.Caption = GetSetting(App.Title, "setup", "User#")
Label2.Caption = GetSetting(App.Title, "setup", "Pass#")
End Sub


Does this look a little screwy? i've got parts right, but i think the pword check is not quite right,
how might i go about this so that it will werk? there must be an easier way to do the password check, i was trying to make
X = 1 thru 100
but it wouldn't werk please help

Thanks,
Tobyn

[This message has been edited by Tobyn (edited 11-05-1999).]

Aaron Young
Nov 5th, 1999, 10:45 AM
Why don't you use a For..Next Loop, eg.

For X = 1 To 10
If txtUser = GetSetting(App.Title, "Setup", "user" & X) And txtPass = GetSetting(App.Title, "Setup", "pass" & X) Then
bLoggedIn = True
Exit For
End If
Next


------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net