Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TextBox Scroll to Bottom

35 views
Skip to first unread message

Peyton Collins

unread,
Mar 20, 2003, 7:56:27 PM3/20/03
to
I have a TextBox that shows a bunch of messages coming in from a bunch of
different threads. All the messages appear at the bottom of the textbox, and
the user cannot see them unless they scroll down to the bottom with the
scroll bar.

Factory floor guys with big gloves don't like scroll bars!

Any way to make the textbox to show the bottom most text, letting the old
test scroll off the top? As these are asynchronous messages and the Textbox
doesn't have focus, I can't do something active to scroll the box, it must
happen automatically.

Thanks!


Daren May

unread,
Mar 20, 2003, 8:28:54 PM3/20/03
to
How about using a ListBox instead and set the SelectedIndex to the Index of
the message you have just added?


"Peyton Collins" <pey...@americanrobot.com> wrote in message
news:ueaG1S07...@TK2MSFTNGP10.phx.gbl...

Steven Licciardi

unread,
Mar 21, 2003, 1:57:37 AM3/21/03
to
Or what about adding the new text to the top of the text box and shifting
the other text down?

Steven

"Daren May" <daren.ge...@spirent.com> wrote in message
news:u0Oq9k07...@TK2MSFTNGP10.phx.gbl...

Daniel Moth

unread,
Mar 21, 2003, 3:47:55 AM3/21/03
to
Assuming you are synchronising access to the TextBox so "the bunch of
different threads" end up calling Invoke... So in the common method that
appends text to your textbox try the following code (you might want to lock
access to MyStringVariable)...

txtMyBox.SelectionStart = txtMyBox.Text.Length;
txtMyBox.SelectedText = MyStringVariable;
txtMyBox.ScrollToCaret();

Cheers
Daniel

"Peyton Collins" <pey...@americanrobot.com> wrote in message
news:ueaG1S07...@TK2MSFTNGP10.phx.gbl...

Peyton Collins

unread,
Mar 21, 2003, 12:54:50 PM3/21/03
to
Now, THAT's a good idea!

"Daniel Moth" <dmo...@hotmail.com> wrote in message
news:u41rsb47...@TK2MSFTNGP12.phx.gbl...

0 new messages