Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LOG IN FORM ================================================
- Public Class Form1
- Dim Username001 As String = Nothing
- Dim Password001 As String = Nothing
- Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
- End Sub
- Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- If System.IO.File.Exists(Application.StartupPath & "\" & TextBox1.Text) Then
- Dim objreader As New System.IO.StreamReader(Application.StartupPath & "\" & TextBox1.Text)
- Username001 = objreader.ReadLine
- Password001 = objreader.ReadLine
- objreader.Close()
- If TextBox1.Text = Username001 Then
- If TextBox2.Text = Password001 Then
- Form2.Show()
- GoTo EndOfScript
- End If
- End If
- End If
- MessageBox.Show("Username or Password is incorrect!")
- EndOfScript:
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Register.Show()
- Me.Hide()
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- End Class
- REGISTER FORM ============================================
- Public Class Register
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- If System.IO.File.Exists(Application.StartupPath & "\" & TextBox1.Text) Then 'Checks To See If The File Path Exists
- System.IO.File.Delete(Application.StartupPath & "\" & TextBox1.Text) 'Deletes The File Path IF It Exists
- Dim objwriter As New System.IO.StreamWriter(Application.StartupPath & "\" & TextBox1.Text) 'Writes/ Creates A File Patj and File
- objwriter.WriteLine(TextBox1.Text) 'Username
- objwriter.WriteLine(TextBox2.Text) 'Password
- objwriter.Close() 'Closes Our Object Writer
- Else
- Dim objwriter As New System.IO.StreamWriter(Application.StartupPath & "\" & TextBox1.Text)
- objwriter.WriteLine(TextBox1.Text) 'Username
- objwriter.WriteLine(TextBox2.Text) 'Password
- objwriter.Close()
- End If
- Form1.Show()
- Me.Close()
- End Sub
- Private Sub Register_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement