Android Question Adding text to CSV file

Justin1234

Member
Licensed User
Longtime User
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?
 

Justin1234

Member
Licensed User
Longtime User
Can you post the relevant code?

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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…