Login System (No MySql Etc)
Posted: Tue Apr 06, 2010 9:16 pm
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
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
now goto the form1 login button and enter this codeIf 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
Code: Select all
now goto the form register button and enter this codeTry
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
Code: Select all
and it should now work thank you for viewing my tutorialForm2.show