Results 1 to 13 of 13

Thread: [RESOLVED] Remember Login details

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Posts
    124

    Resolved [RESOLVED] Remember Login details

    Hi,

    anybody show me how to go about saving username/password details, perhaps by using a checkbox
    Attached Images Attached Images  

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Remember Login details

    Where do you want to save them to?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Posts
    124

    Re: Remember Login details

    i dunno what would be best, file or registry, any method would do.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Remember Login details

    Quote Originally Posted by totaly
    i dunno what would be best, file or registry, any method would do.
    file or registry or database table....it depends on you and how much security is an issue.

    Do you want to save them (wherever you decide) as straight text, or do they need to be encrypted/decrypted?

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Posts
    124

    Re: Remember Login details

    Registry will be fine, and security aint a problem so straight text

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Remember Login details

    Are you familiary with VB's SaveSetting and GetSettings functions?

    They are built keywords that will read/write registry entries. They are somewhat limited in their scope insofaras you have only minimal control over where the entries are written, but I think for your purposes they would do just fine.

    Edit: I had to go find this...Here is a CodeBank entry by Martin Liss on this subject.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Posts
    124

    Re: Remember Login details

    Ok, thnx i got this so far, just need to sort out if the chkbox is checked.

    VB Code:
    1. SaveSetting App.EXEName, "LoginDetails", "UserName", txtUserName.Text
    2. SaveSetting App.EXEName, "LoginDetails", "Password", txtPassword.Text
    3.  
    4. txtUserName.text = GetSetting (App.EXEName, "LoginDetails", "UserName", "")
    5. txtPassword.text = GetSetting (App.EXEName, "LoginDetails", "Password", "")

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Remember Login details

    In your OK button click event put
    VB Code:
    1. If chkSave.Value = vbChecked Then
    2.    SaveSetting App.EXEName, "LoginDetails", "UserName", txtUserName.Text
    3.    SaveSetting App.EXEName, "LoginDetails", "Password", txtPassword.Text
    4. End If

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Posts
    124

    Re: [RESOLVED] Remember Login details

    can u help with saving the checkbox true/false

    the username+pass is stored, but ofcourse nextime the checkbox aint ticked

  10. #10
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Remember Login details

    Quote Originally Posted by Hack
    In your OK button click event put
    VB Code:
    1. If chkSave.Value = vbChecked Then
    2.    SaveSetting App.EXEName, "LoginDetails", "UserName", txtUserName.Text
    3.    SaveSetting App.EXEName, "LoginDetails", "Password", txtPassword.Text
    4. End If
    You could just save the checkbox value in the registry like you did with the username/password. Alternatively, you could extend on the above code:

    VB Code:
    1. If chkSave.Value = vbChecked Then
    2.    SaveSetting App.EXEName, "LoginDetails", "UserName", txtUserName.Text
    3.    SaveSetting App.EXEName, "LoginDetails", "Password", txtPassword.Text
    4. Else
    5.     DeleteSetting App.EXEName, "LoginDetails"
    6. End If

    And after you read back the username/password, you can do this:

    VB Code:
    1. If Len(txtUser.Text) = 0 And Len(txtPass.Text) = 0 Then
    2.     chkSave.Value = 0
    3. Else
    4.     chkSave.Value = 1
    5. End If

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Posts
    124

    Re: [RESOLVED] Remember Login details

    i see so

    VB Code:
    1. chksave.value = GetSetting (App.EXEName, "LoginDetails", "Save", "")

    VB Code:
    1. SaveSetting App.EXEName, "LoginDetails", "Save", chksave.value

  12. #12
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: [RESOLVED] Remember Login details

    VB Code:
    1. chksave.value = CInt(GetSetting (App.EXEName, "LoginDetails", "Save", "[B]0[/B]"))


  13. #13

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Posts
    124

    Re: [RESOLVED] Remember Login details

    ah thnx, i was getting a type mistmatch, fixed now

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