Replacing a character at a position in RichTextBox

  • Thread starter Thread starter Guest
  • Start date Start date
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")
 
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
 
Back
Top