When I add a new record to the Listbox from textboxes - it replaces my original text in the text file. :confused:
Any ideas on why? This is what I've got...
Any ideas on why? This is what I've got...
Code:
Private Sub cmdAdd_Click(sender As Object, e As EventArgs) Handles cmdAdd.Click
Dim UpdateCustomerFile As New System.IO.StreamWriter("C:\Users\tabitha.vockler\Documents\Customers.txt")
Dim UpdateRecord As String
UpdateRecord = txtFirstName.Text + "," + txtSurname.Text + "," + txtMobile.Text + "," + cboDiscount.Text
UpdateCustomerFile.WriteLine(UpdateRecord)
UpdateCustomerFile.Close()
My.Computer.FileSystem.OpenTextFileReader("C:\Users\tabitha.vockler\Documents\Customers.txt")
Dim A() As String = IO.File.ReadAllLines("C:\Users\tabitha.vockler\Documents\Customers.txt")
For Each Content As String In A
lstCustomers.Items.Add(Content)
Next
End Sub