Hi,
anybody show me how to go about saving username/password details, perhaps by using a checkbox
Printable View
Hi,
anybody show me how to go about saving username/password details, perhaps by using a checkbox
Where do you want to save them to?
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.Quote:
Originally Posted by totaly
Do you want to save them (wherever you decide) as straight text, or do they need to be encrypted/decrypted?
Registry will be fine, and security aint a problem so straight text
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.
Ok, thnx i got this so far, just need to sort out if the chkbox is checked.
VB Code:
SaveSetting App.EXEName, "LoginDetails", "UserName", txtUserName.Text SaveSetting App.EXEName, "LoginDetails", "Password", txtPassword.Text txtUserName.text = GetSetting (App.EXEName, "LoginDetails", "UserName", "") txtPassword.text = GetSetting (App.EXEName, "LoginDetails", "Password", "")
In your OK button click event putVB Code:
If chkSave.Value = vbChecked Then SaveSetting App.EXEName, "LoginDetails", "UserName", txtUserName.Text SaveSetting App.EXEName, "LoginDetails", "Password", txtPassword.Text End If
can u help with saving the checkbox true/false
the username+pass is stored, but ofcourse nextime the checkbox aint ticked
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:Quote:
Originally Posted by Hack
VB Code:
If chkSave.Value = vbChecked Then SaveSetting App.EXEName, "LoginDetails", "UserName", txtUserName.Text SaveSetting App.EXEName, "LoginDetails", "Password", txtPassword.Text Else DeleteSetting App.EXEName, "LoginDetails" End If
And after you read back the username/password, you can do this:
VB Code:
If Len(txtUser.Text) = 0 And Len(txtPass.Text) = 0 Then chkSave.Value = 0 Else chkSave.Value = 1 End If
i see so
VB Code:
chksave.value = GetSetting (App.EXEName, "LoginDetails", "Save", "")
VB Code:
SaveSetting App.EXEName, "LoginDetails", "Save", chksave.value
VB Code:
chksave.value = CInt(GetSetting (App.EXEName, "LoginDetails", "Save", "[B]0[/B]"))
:)
ah thnx, i was getting a type mistmatch, fixed now