Replacing a character at a position in RichTextBox

G

Guest

Hi,
Is there any way to replace a character at a position? Without cussing the
RichTextBox to scroll. For example the following code will replaces the by
removing but the side effect is that it will cause it to scroll.


aRichtext.Text = aRichtext.Text.Remove(position, 1)
aRichtext.Text = aRichtext.Text.Insert(position, "Y")
 
G

Guest

Hi Al,

If I have undestood the solution will be similar to:

aRichtext.Text = aRichtext.Text.Remove(position, 1)
aRichtext.Text = aRichtext.Text.Insert(position, "Y")
aRichtext.Focus()
aRichtext.SelectionStart = position
aRichtext.ScrollToCaret()

I hope that helps.

Kind Regards,

Jorge Serrano Pérez
MVP VB.NET
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top