Login System (No MySql Etc)

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.
15 posts Page 2 of 2
Contributors
User avatar
graves
New Member
New Member
Posts: 17
Joined: Sun Apr 18, 2010 8:17 am

Re: Login System (No MySql Etc)
graves
i know it is i tried capital and lower case, i just took the pic with the capitals cause thats what i had on it.
Lewis
Coding God
Coding God
Posts: 1564
Joined: Sun Dec 20, 2009 2:12 pm

Re: Login System (No MySql Etc)
Lewis
Try this..

Form2 Register button 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.ToLower) Then
            MsgBox("Error - account already exists", MsgBoxStyle.Critical)
        Else
            MkDir("C:\LoginInfo\" + TextBox1.Text.ToLower)
            Dim a As New System.IO.StreamWriter("C:\LoginInfo\" + TextBox1.Text.ToLower + "\Username.txt")
            a.WriteLine(TextBox1.Text.ToLower)
            a.Close()

            Dim b As New System.IO.StreamWriter("C:\LoginInfo\" + TextBox1.Text.ToLower + "\Password.txt")
            b.WriteLine(TextBox2.Text.ToLower)
            b.Close()
            MsgBox("Account created")
        End If
Form 1 Login Button
Code: Select all
Try
            Dim sa As String
            Dim sb As String

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

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

            If TextBox4.Text.ToLower = sa.ToString Then

                If TextBox3.Text.ToLower = 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
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Login System (No MySql Etc)
mandai
Seems a bit messy using a directory per user like that.

I'd do it all in one text file, maybe having each users' details per line with a seperator between the username/password values.
Lewis
Coding God
Coding God
Posts: 1564
Joined: Sun Dec 20, 2009 2:12 pm

Re: Login System (No MySql Etc)
Lewis
Well i was just showing graves the code of how to do it in another way :)
Image
User avatar
TehCoder
Just Registered
Just Registered
Posts: 5
Joined: Thu Jul 08, 2010 2:32 pm

Re: Login System (No MySql Etc)
TehCoder
Nice tutorial ManMega1 cooll;
15 posts Page 2 of 2
Return to “Tutorials”