Page 2 of 2

Re: Login System (No MySql Etc)

Posted: Thu Apr 22, 2010 11:03 pm
by 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.

Re: Login System (No MySql Etc)

Posted: Fri Apr 23, 2010 7:44 pm
by 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

Re: Login System (No MySql Etc)

Posted: Thu Apr 29, 2010 10:00 pm
by 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.

Re: Login System (No MySql Etc)

Posted: Fri Apr 30, 2010 12:19 pm
by Lewis
Well i was just showing graves the code of how to do it in another way :)

Re: Login System (No MySql Etc)

Posted: Thu Jul 08, 2010 3:07 pm
by TehCoder
Nice tutorial ManMega1 cooll;