473,402 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Scroll to bottom of textbox

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
3 11937
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
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
* "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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mad Scientist Jr | last post by:
I have a textbox that i am adding to (in codebehind of ASP.NET) and need to ensure that the focus is scrolled to the bottom of the textbox each time the page refreshes, and then set focus to a 2nd...
0
by: Alex Moskalyuk | last post by:
I am using System.Windows.Forms.TextBox to publish some real-time data that's coming off the external devices. My data is fed into the TextBox with proper precautions not to exceed the MaxSize...
7
by: Mel Weaver | last post by:
Hello, How do you scroll to the bottom of a multiline textbox in code? Mel
1
by: JC | last post by:
I'm sure you've all seen the save scroll position from 4 guys from rolla which can be found here > http://aspnet.4guysfromrolla.com/articles/111704-1.aspx BUT try to get that to work AND still be...
3
by: Rvo | last post by:
I have a userform which contains a textbox (System.Windows.forms.textbox) with multiline set to True. This box contains a certain number of characters which reach below the bottom of the box....
6
by: UJ | last post by:
I've got a multiline textbox that I'm using to display messages. Is there an easy way to have it scroll to the end after I add a line to the text of the box? TIA - Jeff.
0
by: Rachel | last post by:
I am developing an application for Windows Mobile devices using C#. I have a form that has several controls (labels and textboxes that are dynamically created on opening the form) and a vertical...
0
by: Brian Keating | last post by:
Hi there, Does anyone know if i can determin if the scroll position is at the bottom of my textbox? I can get the scroll position fine, but how do i know if it's actually at the bottom? ...
1
by: NehaDas | last post by:
Hello Everyone ! Iam relatively new to .NET C# and m still in the process of exploring various options. Any help with regard to this query will be highly appreciated ... Iam working on an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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,...
0
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...

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.