int index = richTextBox1.GetFirstCharIndexOfCurrentLine(); int line = richTextBox1.GetLineFromCharIndex(index);