What I am trying to do is stream write to a text file information from 5 columns I have in my list view and then read the data back into those columns as required. I have manage to write the data to the text file in this format
1,Facemill,2290 ,2545 ,0.622
I have Split the info with a comma
I can read the info back into my Listview only as one line of information. What I dont know how to do is split the line at every comma and place the info back in its correct column and then split the next line ETC. The code I have up to now is this.
Try Dim sr As StreamReader Dim fs As FileStream 'clearing listview data toavoid confusion ListView1.Items.Clear() 'filestream object to open and read file fs = New FileStream(("c:\listview.txt"), FileMode.OpenOrCreate) 'stream reader object to read streamed input sr = New StreamReader(fs) Dim itm As Object 'reading line by line itm = sr.ReadLine While Not itm = Nothing ListView1.Items.Add(itm) 'readline from stream sr.ReadLine() End While 'close stream reader and filestrema object sr.Close() fs.Close() Catch ex As System.Exception System.Windows.Forms.MessageBox.Show(ex.Message, "Load Tool Data Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try
If anybody can help and show me how to this it would be much appreciated