Poll: Did this help you?
You do not have permission to vote in this poll.
Yes
87.10%
27 87.10%
Sort of
0%
0 0%
Not really
0%
0 0%
It's garbage, throw it out.
12.90%
4 12.90%
Total 31 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remember password & username
#1
Difficultly: 1/5
Time: Three minutes

Hello, I am completely new here, but I know my way around VB6 a little, so I worked up a code that remembers your username and password if you check a button.
Here goes:

OK, first open up your frmLogin and add a check box and call it RPass. Then double click on the connect button and add this code to the top, right under the Private sub picConnect_click():

Code:
If RPass.Value = 1 Then
Open "Data.ini" For Output As #f
Print #f, "[SETTINGS]"
Print #f, "Last User= "
Print #f, txtName
Print #f, "Last Password= "
Print #f, txtPassword
Close #f
Else
End If

Then add this into the form_load()

Code:
f = FreeFile

Dim n
Dim O
Dim usr
Dim t
Dim pass
On Error GoTo Error
Open "Data.ini" For Input As #f

Input #f, n
Input #f, O
Input #f, usr
Input #f, t
Input #f, pass
Close #f
RPass.Value = 1
txtName.Text = usr
txtPassword.Text = pass
Error:

Then up at the top, write this in:
Code:
public f as Integer

That works for me.

Just make sure to keep the Trim part of the code there.
That should do it, but you might have to create a file called data.ini, because it might runtime.

~Braydok
Reply
#2
It's nice to see that you are trying to share your code. Although there are a few things thats wrong. I suggest you test it before sharing it Tongue
Reply
#3
My votes winning!
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#4
William Wrote:It's nice to see that you are trying to share your code. Although there are a few things thats wrong. I suggest you test it before sharing it Tongue

Shoot you, I did test it, did you think I would not test it?
Reply
#5
Bah, the code you supplied will only save it. Not load it into the text boxes.
Reply
#6
Braydok Wrote:
William Wrote:It's nice to see that you are trying to share your code. Although there are a few things thats wrong. I suggest you test it before sharing it Tongue

Shoot you, I did test it, did you think I would not test it?


Yes. We obviously think you didn't test it because it doesn't work.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#7
Shit, your right, forgive me, here is the full code:

In the sub connect_click()
Code:
Private Sub picConnect_Click()
If RPass.Value = 1 Then
Open "Data.ini" For Output As #f
Print #f, "[SETTINGS]"
Print #f, "Last User= "
Print #f, txtName
Print #f, "Last Password= "
Print #f, txtPassword
Close #f
Else
End If

Then add this into the form_load()

Code:
f = FreeFile

Dim n
Dim O
Dim usr
Dim t
Dim pass
On Error GoTo Error
Open "Data.ini" For Input As #f

Input #f, n
Input #f, O
Input #f, usr
Input #f, t
Input #f, pass
Close #f
RPass.Value = 1
txtName.Text = usr
txtPassword.Text = pass
Error:

Then up at the top, write this in:
Code:
public f as Integer

That works for me.
Is this code good?
Reply
#8
Uh, yeah, I am still new at VB6, just started getting into it one week ago, so I don't know all the PutVar and stuff, so I'll work on that, thanks.

~Braydok
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)