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

Scroll to bottom of textbox

P: n/a
I have a multiline textbox that shows a log. When I keep adding items to
the textbox, I would like it to autoscroll to the bottom. I thought moving
the cursor to the end would do it like (ie.
boxHistory.SelectionStart=999999), which does move the cursor, but doesn't
scroll.

How would I do this? Thanks.

-Rob T.
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Found it: boxHistory.ScrollToCaret() ;-)

"Rob T" <RT*********@DONTwalchemSPAM.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
I have a multiline textbox that shows a log. When I keep adding items to
the textbox, I would like it to autoscroll to the bottom. I thought moving the cursor to the end would do it like (ie.
boxHistory.SelectionStart=999999), which does move the cursor, but doesn't
scroll.

How would I do this? Thanks.

-Rob T.

Nov 20 '05 #2

P: n/a
In article <OW**************@TK2MSFTNGP12.phx.gbl>,
RT*********@DONTwalchemSPAM.com says...
I have a multiline textbox that shows a log. When I keep adding items to
the textbox, I would like it to autoscroll to the bottom. I thought moving
the cursor to the end would do it like (ie.
boxHistory.SelectionStart=999999), which does move the cursor, but doesn't
scroll.

How would I do this? Thanks.


Set SelectionStart to the length of the textbox. Then call the
ScrollToCaret() method.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #3

P: n/a
* "Rob T" <RT*********@DONTwalchemSPAM.com> scripsit:
Found it: boxHistory.ScrollToCaret() ;-)


For RichTextBoxes you will have to set the focus to the control (by
calling its 'Focus' method) before calling this method.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.