Page 1 of 2

Login System (No MySql Etc)

Posted: Tue Apr 06, 2010 9:16 pm
by ManMega1
Hey guys

today im going to show you how to make a login system in visual basic 2008, first open visual basic 2008 and start a new project, call it whatever you want then get 2 labels, 2 buttons and 2 textboxes, name and place them like so (if you want you can change the form name and edit it etc)

http://img697.imageshack.us/img697/6695/54607786.png

then goto "Project" then "Add Windows Form..." and call that whatever you want, then add 2 labels, 1 button and 2 textboxes then name and place them like so

http://img502.imageshack.us/img502/5562/12020193.png

now double click the form2 register button and enter this code
Code: Select all
If My.Computer.FileSystem.DirectoryExists("C:\LoginInfo\") Then
        Else
            MkDir("C:\LoginInfo\")
        End If

        If My.Computer.FileSystem.DirectoryExists("C:\LoginInfo\" + TextBox1.Text) Then
            MsgBox("Error - account already exists", MsgBoxStyle.Critical)
        Else
            MkDir("C:\LoginInfo\" + TextBox1.Text)
            Dim a As New System.IO.StreamWriter("C:\LoginInfo\" + TextBox1.Text + "\Username.txt")
            a.WriteLine(TextBox1.Text)
            a.Close()

            Dim b As New System.IO.StreamWriter("C:\LoginInfo\" + TextBox1.Text + "\Password.txt")
            b.WriteLine(TextBox2.Text)
            b.Close()
            MsgBox("Account created")
        End If
now goto the form1 login button and enter this code
Code: Select all
Try
            Dim sa As String
            Dim sb As String

            Dim a As New System.IO.StreamReader("C:\LoginInfo\" + TextBox4.Text + "\Username.txt")
            sa = a.ReadLine()
            a.Close()

            Dim b As New System.IO.StreamReader("C:\LoginInfo\" + TextBox3.Text + "\Password.txt")
            sb = b.ReadLine()
            b.Close()

            If TextBox4.Text = sa.ToString Then

                If TextBox3.Text = sb.ToString Then

                    MsgBox("Welcome " + sa.ToString)
                    Form2.Show()
                Else
                    MsgBox("Error - password incorrect")
                End If
            Else
                MsgBox("Error - account does not exist")
            End If
        Catch ex As Exception
            MsgBox("Error - " + ex.Message)
        End Try
now goto the form register button and enter this code
Code: Select all
Form2.show
and it should now work thank you for viewing my tutorial

Re: Login System (No MySql Etc)

Posted: Wed Apr 07, 2010 4:28 pm
by WaynesWorld2010
manmega1 did u see my one i did

Re: Login System (No MySql Etc)

Posted: Wed Apr 07, 2010 8:17 pm
by ManMega1
WaynesWorld2010 wrote:
manmega1 did u see my one i did
no i dont think i did, sorry

Re: Login System (No MySql Etc)

Posted: Thu Apr 08, 2010 1:22 pm
by Insignia
Nice tutorial, ManMega1!

Re: Login System (No MySql Etc)

Posted: Tue Apr 13, 2010 10:27 pm
by rocky4126
hi I been reading other websites tutorials on this but all they can do is either make it look hard or use mySQL, you though, how the hell do you do it?! You make it look so easy XD, Thanks for the tut, rep button pressed and gratitude given

Thanks, John

Re: Login System (No MySql Etc)

Posted: Tue Apr 13, 2010 11:09 pm
by ManMega1
rocky4126 wrote:
hi I been reading other websites tutorials on this but all they can do is either make it look hard or use mySQL, you though, how the hell do you do it?! You make it look so easy XD, Thanks for the tut, rep button pressed and gratitude given

Thanks, John
thanks, that means a lot, to do this i found it quite easy, :)

Re: Login System (No MySql Etc)

Posted: Sun Apr 18, 2010 7:52 pm
by graves
hey, this doesnt work for me, i put put everything then i make an account and it says its been created and i try to login it says error- account is not created. but then when i remake the account it says its already made.

any help?

Re: Login System (No MySql Etc)

Posted: Sun Apr 18, 2010 9:16 pm
by ManMega1
graves wrote:
hey, this doesnt work for me, i put put everything then i make an account and it says its been created and i try to login it says error- account is not created. but then when i remake the account it says its already made.

any help?
Hmm, not sure why, works for everyone else (including me) try re-check to see if you have put all the correct coding in the right place cooll;

Re: Login System (No MySql Etc)

Posted: Thu Apr 22, 2010 1:54 am
by graves
Image
Image

Re: Login System (No MySql Etc)

Posted: Thu Apr 22, 2010 3:46 pm
by ManMega1
Hey graves

hmm, weird, i'm sure it works for me, but if i find a problem, i will update the code, it is case sensetives

e.g. Username: "graves" Password: "graves"