Text in RichTextBox scrolls out of "sight" ...

J

Joe HM

Hello -

I have a GUI that uses a RichTextBox to output text. The problem is
that if this box ouput text while hidden behind another window, it is
blank when I bring it to the foreground. The text is there when I
click on the scroll button on the scrollbar but it seems to be scrolled
"up" all the way.

The following code is used to add new text to that box with a certain
color:

Dim lTextLength As Integer = aRichTextBox.TextLength()

' The following will append aString in aColor to the Text of the
' aRichTextBox.

aRichTextBox.Select(lTextLength, 0)

aRichTextBox.SelectionColor = aColor
aRichTextBox.SelectedText = aString

' This will set the cursor to the end of the text so that it
' scrolls and becomes visible.

aRichTextBox.Select(aRichTextBox.TextLength(), 0)

The last line of code is something I added hoping it would show the
text.

Is this a problem with the RichTextBox or am I doing something wrong
when I add text to the box?

Thanks!
Joe
 

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