J Justin1234 Member Licensed User Longtime User Jan 14, 2014 #1 Hi, I'm trying to write a line to the end of a csv file. I'm currently using textwriter to do this but when I reload the table its messed up. However if I open and save it (without making any changes) in another app it then displays properly. I would prefer to use that as I've already coded it and it's easy to use but should I be using a method other than textwriter?
Hi, I'm trying to write a line to the end of a csv file. I'm currently using textwriter to do this but when I reload the table its messed up. However if I open and save it (without making any changes) in another app it then displays properly. I would prefer to use that as I've already coded it and it's easy to use but should I be using a method other than textwriter?
Erel B4X founder Staff member Licensed User Longtime User Jan 14, 2014 #2 Can you post the relevant code? Upvote 0
J Justin1234 Member Licensed User Longtime User Jan 14, 2014 #3 Erel said: Can you post the relevant code? Click to expand... Dim MyTextWriter As TextWriter Dim temp As String =(receiptdir2 & ".csv") MyTextWriter.Initialize(File.OpenOutput(receiptmain, temp,True)) Dim temp2 As String = (CRLF & DateTime.Date(DateTime.Now) & "," & Main.csvfile & "," & Main.csvamount) MyTextWriter.Write (temp2) MyTextWriter.Flush MyTextWriter.Close To open then table im using the scrollview example. The above code puts the text in the file fine if I open it in a different reader but not with the code from the example unless I save it in the other reader first. Ive also used .writeline with the same results. Upvote 0
Erel said: Can you post the relevant code? Click to expand... Dim MyTextWriter As TextWriter Dim temp As String =(receiptdir2 & ".csv") MyTextWriter.Initialize(File.OpenOutput(receiptmain, temp,True)) Dim temp2 As String = (CRLF & DateTime.Date(DateTime.Now) & "," & Main.csvfile & "," & Main.csvamount) MyTextWriter.Write (temp2) MyTextWriter.Flush MyTextWriter.Close To open then table im using the scrollview example. The above code puts the text in the file fine if I open it in a different reader but not with the code from the example unless I save it in the other reader first. Ive also used .writeline with the same results.
Erel B4X founder Staff member Licensed User Longtime User Jan 14, 2014 #4 Your code looks fine. The problem is probably somewhere else. Upvote 0
J Justin1234 Member Licensed User Longtime User Jan 14, 2014 #5 I'm a bit lost. I've tried to fix it for quite a few hours now with no results. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 14, 2014 #6 Can you upload your project (File - Export as zip)? Upvote 0