How do I get the current line and column numbers in a RichTextBox in a Winforms application?
NOTE
Folks, I just want a simple solution, if i
Thought I'd post a slightly simpler way of doing it.
// Get the line.
int index = richTextBox.SelectionStart;
int line = richTextBox.GetLineFromCharIndex(index);
// Get the column.
int firstChar = richTextBox.GetFirstCharIndexFromLine(line);
int column = index - firstChar;
Get the current selected index, get the current line, then to get the column subtract the selected index from the index of the first character of that line.