Reputation: 7601
For moving cursor to last position I am using following code(which works fine)
rtbLog.SelectionStart = rtbLog.Text.Length;
rtbLog.ScrollToCaret();
How to move cursor to first position in last line of RichTextBox?
Upvotes: 0
Views: 2084
Reputation: 2488
You can do it using last index of Environment.Newline
:
rtbLog.SelectionStart = rtbLog.Text.LastIndexOfAny(Environment.NewLine.ToCharArray()) + 1 ;
rtbLog.ScrollToCaret();
Upvotes: 2