How to set RichTextBox cursor to the end?

I use System.Windows.Forms.RichTextBoxand do something like

RichTextBox1.Text = "Hello World";

But after this expression, the cursor position in the RichTextBox remains at the beginning. Is there any way to install it to the end?

+3
source share
1 answer

This should do it for you:

RichTextBox1.Select(RichTextBox1.Text.Length - 1, 0);

Edit: If there is a lot of text in the text field and which it also looks in the frame, add this line:

RichTextBox1.ScrollToCaret();

See msdn for details .

+10
source

Source: https://habr.com/ru/post/1761902/


All Articles