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.
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.
Try this..
Form2 Register button code:
Form2 Register button code:
Code: Select all
Form 1 Login Button
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
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
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.
I'd do it all in one text file, maybe having each users' details per line with a seperator between the username/password values.
Well i was just showing graves the code of how to do it in another way 

Copyright Information
Copyright © Codenstuff.com 2020 - 2023