By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,691 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,691 IT Pros & Developers. It's quick & easy.

Replacing a character at a position in RichTextBox

P: n/a
Al
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")
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
"Al" wrote:
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")

Nov 21 '05 #2

P: n/a
Al
Thanks Jorge, but it behaves the same as the origional couple lines :(

"Jorge Serrano [MVP VB]" wrote:
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
"Al" wrote:
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")

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.