Results 1 to 2 of 2

Thread: Passwords/Usernames in the registry

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    Chemainus,BC,Canada
    Posts
    7

    Post

    Hey,
    heres my code, i need a little help please

    Code:
    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).]

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Why don't you use a For..Next Loop, eg.
    Code:
    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
    [email protected]
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width