473,506 Members | 11,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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

Jan 17 '07 #1
1 1431
Hello -

Great ... I'll give that a try.

Thanks,
Joe

On Jan 18, 10:01 am, Michel Posseth [MCP]
<MichelPosseth...@discussions.microsoft.comwrote :
I use the rich textbox control mostly for programs that have a status log
function

in these programs i use this method

Private Sub writeText(ByVal text As String, ByVal Kleur As
System.Drawing.Color)
Me.RtbxRapp.SelectionColor = Kleur
Me.RtbxRapp.AppendText(text)
Me.RtbxRapp.ScrollToCaret()
end sub

"Joe HM" wrote:
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- Hide quoted text -- Show quoted text -
Jan 18 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2589
by: Henrik S. Hansen | last post by:
I'm new to C++, and cannot figure out why this won't compile: std::map<std::string, int> tst; tst = 1; int main() { /*...*/ } It gives me: error: ISO C++ forbids declaration of `tst' with...
13
141211
by: Squid Seven | last post by:
This is just bizarre. for the following snippet of code: #include <string> using std::string; I get the error message:
24
2319
by: Apotheosis | last post by:
The problem professor gave us is: Write a program which reads two integer values. If the first is less than the second, print the message "up". If the second is less than the first, print the...
13
2494
by: baumann.Pan | last post by:
when define char *p = " can not modify"; p ='b' ;is not allowed, but if you declare p as char p = "can modify"; p = 'b'; is ok? why?
18
11825
by: Martin Jørgensen | last post by:
Hi, Today I got a really strange problem... I've made myself a data-file and I read in data from that file.... When I read something like this line: 03 04 05, 00 04 01, 05 03 07, 08 03...
4
768
by: Chicagoboy27 | last post by:
All I am trying to find a solution for removing the ?returnUrl if a user is not authenticated. I want to be redirect an unauthenticated user to the login.aspx less the returnUrl. Once they log...
0
1121
by: U S Contractors Offering Service A Non-profit | last post by:
" Hind sight is that of 20/20 they say ? " Craig Somerford to New More options 3:49 pm (0 minutes ago) " The calm before the STORM... SNOW STORM that is " Craig Somerford
0
1700
by: U S Contractors Offering Service A Non-profit | last post by:
ALOT of them to pick from... Inbox Reply Craig Somerford to uscosoct24, Matthew, B-eing-I-nstru., Ed, me, New, mw, Natural, (bcc:USA), (bcc:Letters), (bcc:lvargas), (bcc:Le), (bcc:staff),...
0
1018
by: service0059 | last post by:
This category is designed to enable you to have all the important information right at your fingertips and create better "sight value". You will learn how karat gold affects appeal and value and...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7479
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1534
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.