0

I am writing a program which accepts an input to a RichTextBox which will be edited by:

: will be replaced with , and I want to add to the start of every line "linenumber," I worked out how to add the comma and replace the : but I am struggling to add the line number.

I have searched quite a bit but could not find a solution usable in this case

My code so far:

private void button1_Click(object sender, EventArgs e)
{
  richTextBox1.Text = richTextBox1.Text.Replace(":", ",");
  richTextBox1.Lines = Array.ConvertAll(richTextBox1.Lines, line => "," + line);
}
LarsTech
  • 80,625
  • 14
  • 153
  • 225

0 Answers0