Every time I press "button2" it should take the data from various text boxes and write them into my text file on a new line. For some unknown reason, the program just overwrites everything in the text file, whereas I need it to write to a new line. If someone knows how to do this please let me know!
Refer the below Code:
Public Class Form5
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
Form2.Show()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim username As String = (TextBox1.Text & TextBox2.Text)
Dim password As String = "password"
Dim forename As String = TextBox1.Text
Dim surname As String = TextBox2.Text
Dim dob As String = TextBox3.Text
Dim phone As String = TextBox4.Text
Dim address As String = TextBox5.Text
Dim filename As String = "../../usernamepassword.txt"
Dim objreader As New System.IO.StreamWriter(filename)
objreader.WriteLine(username & "," & password & "," & forename & "," & surname & "," & dob & "," & phone & "," & address & ",")
objreader.Close()
End Sub