Remember Me Function

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
11 posts Page 1 of 2
Contributors
User avatar
MasterCoding
Top Poster
Top Poster
Posts: 156
Joined: Sat Oct 24, 2009 4:26 pm

Remember Me Function
MasterCoding
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)
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
User avatar
Nery
Co-Admin Moderator
Co-Admin Moderator
Posts: 1117
Joined: Mon Sep 07, 2009 8:11 pm

Re: Remember Me Function
Nery
Instead of making 2 IF Statements do the following (there are bad habits you should take care of like the "If Checkbox1.Checked = False"
Code: Select all
If Not Checkbox1.Checked Then
      Me.Settings.RememberMe = False
Else
      My.Settings.RememberMe = True
End If
Thats the correct way (It's simplier and thats how professionals do)
User avatar
MasterCoding
Top Poster
Top Poster
Posts: 156
Joined: Sat Oct 24, 2009 4:26 pm

Re: Remember Me Function
MasterCoding
damned i never have thinked about that
User avatar
Robby
VIP - Donator
VIP - Donator
Posts: 417
Joined: Mon Aug 03, 2009 4:01 am

Re: Remember Me Function
Robby
good job! this is really good. and yes u should use the cod that nery has it is shorter,better and pro.

try to keep ur code the shorest it can go to so if ypu give out a source the person can read ass it aint too much
My current Projects Listed Below:
Toixt++ Text Editor Just 10 or less more features to go!
Image
Image
User avatar
Nery
Co-Admin Moderator
Co-Admin Moderator
Posts: 1117
Joined: Mon Sep 07, 2009 8:11 pm

Re: Remember Me Function
Nery
Yes, check the video link I've posted: viewtopic.php?f=35&t=623 It may help you.
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: Remember Me Function
Usman55
Hello everyone!
I have a request for you all...
Please put a detail of at least 2 lines in the top of your tutorial that what the program actually does!
I hope you will accept this...
Bye everyone!
Image
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: Remember Me Function
Usman55
Hello!

I also want to say that we should improve our grammar... It is really important!

Thanks!
Image
User avatar
Nery
Co-Admin Moderator
Co-Admin Moderator
Posts: 1117
Joined: Mon Sep 07, 2009 8:11 pm

Re: Remember Me Function
Nery
"I gonna learn you how to add a remember me function to your application"

Its not "I gonna learn you"... its "I'm going to teach you" or "I'm gonna teach you".
User avatar
MasterCoding
Top Poster
Top Poster
Posts: 156
Joined: Sat Oct 24, 2009 4:26 pm

Re: Remember Me Function
MasterCoding
i maked this code just like this so i don;'t know it anymore actuly

ps. im very sleepy its really late now 1:18
User avatar
Toxikr3
Dedicated Member
Dedicated Member
Posts: 69
Joined: Tue Dec 08, 2009 12:49 am

Re: Remember Me Function
Toxikr3
Usman55 wrote:
Hello everyone!
I have a request for you all...
Please put a detail of at least 2 lines in the top of your tutorial that what the program actually does!
I hope you will accept this...
Bye everyone!

"Remember me function" makes perfect sense to me about the content of this thread...

Also, very helpful tutorial, thanks!

-Toxikr3
11 posts Page 1 of 2
Return to “Tutorials”