3
Answers

save to csv problem

Lili R

Lili R

8y
334
1
Hi
 
I am using this code to save data from richTextBox  to  .csv file.
  
 
 
richTextBox1.Text = csv.ToString();
string savefileDirectory = Path.GetDirectoryName(opfd.FileName).ToString() + "\\Results\\";
if (!Directory.Exists(savefileDirectory))
Directory.CreateDirectory(savefileDirectory);
//to save the changed files.........................................................
SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = savefileDirectory + "fileR1" + ".csv";
//File.WriteAllLines(sfd.FileName, richTextBox1.Lines);
 
 
 
But what i am getting is data saved in .csv file separated  with commas in a line or row, not separated by cells in a row.
 Something  like this:  234,456,wer45,22-00-99 
 
I wanted if data could come in separate cells in every row without showing the comma. So I need help if anyone knows where i am going wrong.
 
Thanks 

Answers (3)