rrama
rrama

Reputation: 15

how to move the cursor at the end of the richtext box in vb 2008

i am adding an text while i press enter in the rich text box after that the cursor is in the top of the string how to make it at the end of the string

 If e.KeyCode = Keys.Enter Then
            RichTextBox1.Text = RichTextBox1.Text + "enter"

        End If

can any one tell me how can i do that

Upvotes: 1

Views: 4201

Answers (1)

Hans Olsson
Hans Olsson

Reputation: 55009

Assuming that I understand your question correctly, I think you need to do:

RichTextBox1.SelectionStart = RichTextBox1.TextLength

If the text scrolls away, you might also need to do a:

RichTextBox1.ScrollToCaret()

Upvotes: 2

Related Questions