Glenn Patton

Glenn Patton

  • NA
  • 308
  • 82.8k

Simplest way of adding a ',' to each line of a rich text box

Mar 6 2012 9:40 AM
Hi All,

In finishing off a bit of test code I'm doing I have some results shoved to a rich text box.  I am trying to add a ',' to the end of each line I am doing the following 

StreamWriter sw = new StreamWriter(filePutter.FileName);
sw.WriteLine("Pitstop 2.0 Transparent Data " + DateTime.Now.ToString() + " Serial Number:" + txtSerialNumberRead.Text + ",");
sw.Write(rtbTransparentLog.Text);
this while it saves the data does not give what I need i.e.:
                 data,
it gives
,data 
The rtbox is updated with 
rtbTransparentLog.Text +=","+ myComPort.ReadLine();
by placing the comma after  rtbTransparentLog.Text +=myComPort.ReadLine()+",";
means the same still happens due to the line feed stuck on the end. Any quickways if getting it in there?
Glenn

Answers (2)