if you want to insert line numbers into richtextbox control. Suppose you have a richtextbox control with the some text of lines and you want to add line number as prefix (1,2,3…), you can use the following code of lines:
string[] arrStr = richTextBox1.Lines;
for (int i = 0; i < arrStr.Length ; i++)
{
arrStr[i] = i+1 + ". " + arrStr[i];
}
richTextBox1.Lines = arrStr;

Try the code..
Thanks