Remember Me Function
Posted: Fri Nov 27, 2009 8:39 pm
I gonna learn you how to add a remember me function to your application
whe need
3 textboxes
Name Textbox1 to username
Name Textbox2 to Password
and name textbox3 to Nothing1
and make nothing1 then to visible false
1 checkbox
change the text to Remember Me
2 labels(optional)
label1 change the text to username
label2 change the text to password
lets start
with my project settings
and add this settings
![Image]()
and then code it
the hole code here i don't wanna do it in parts the code because some begginers don't know where the options are(dont know how to say it else that options)
whe need
3 textboxes
Name Textbox1 to username
Name Textbox2 to Password
and name textbox3 to Nothing1
and make nothing1 then to visible false
1 checkbox
change the text to Remember Me
2 labels(optional)
label1 change the text to username
label2 change the text to password
lets start
with my project settings
and add this settings

and then code it
the hole code here i don't wanna do it in parts the code because some begginers don't know where the options are(dont know how to say it else that options)
Code: Select all
Public Class Form1
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
My.Settings.RememberMe = True
End If
If CheckBox1.Checked = False Then
My.Settings.RememberMe = False
End If
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If My.Settings.RememberMe = True Then
My.Settings.Username = Username.Text
My.Settings.Password = Password.Text
End If
If My.Settings.RememberMe = False Then
Nothing1.Text = My.Settings.Username
Nothing1.Text = My.Settings.Password
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Settings.RememberMe = True Then
Username.Text = My.Settings.Username
Password.Text = My.Settings.Password
CheckBox1.Checked = True
End If
If My.Settings.RememberMe = False Then
My.Settings.Username = Username.Text
My.Settings.Password = Password.Text
CheckBox1.Checked = False
End If
End Sub
End Class