View Single Post
  #34 (permalink)  
Old 09-17-2008, 04:31 PM
PlayaSkater's Avatar   
PlayaSkater PlayaSkater is offline
Learning Programmer
 
Join Date: Aug 2007
Location: Cruzer, US
Age: 18
Posts: 63
Credits: 0
Rep Power: 6
PlayaSkater is on a distinguished road
Default Re: C# Tutorial: Writing Text Files

Quote:
Originally Posted by Brumo View Post
Yow, Thanks for the tutorial

I am working on some thing atm but i cant find out why thsi write my information twice in the same row
Code:
String AllData = (ID) + (";") + (Name) + (";") + (Date) + (";") + (Time)

           StreamWriter sw = new StreamWriter(@"C:\TimeTable.csv", true); 
           string bufferOne = (AllData);
           sw.Write(bufferOne);
           sw.WriteLine(bufferOne);

           sw.Close();
           sw.Dispose();
It is returning the same information twice as i mentioned before but i dont know why because i use the variable only once in the writeline proces:s although i am appending the Timetable maybe that has to do with it something.
Because you tell it to. sw.Write(bufferOne);
sw.WriteLine(bufferOne);
writes it twice. Remove one of those and try it again.

Btw, Xav, I got my previous problem fixed. It turns out that the code I had before worked. I don't know what happened, maybe I didn't build, but it's fine now.
Reply With Quote