Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
Auto scrolling a textbox control
Messages   Related Types
This message was discovered on microsoft.public.dotnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Ben Urbanski
GOOD ANSWER
Hello,

Does anyone know how it can auto scroll a textbox control? I'm using one to
display a log to which I append data. I'd like the textbox to scroll down in
pace with the data I'm appending. (I'm developing in C#.)

Thanks,

Ben

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
Lion Shi (VIP)
GOOD ANSWER
Hello Ben,

You can scroll the TextBox to the bottom via code. The ScrollToCaret method
is helpful to do that. You can set the Caret to the end of the Text and
then scroll to it. This is a sample code:

textBox1.AppendText("This is a test string \n");
textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();

I hope it helps.

Best regards,

Lion Shi, MCSE, MCSD
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
Reply-To: "Ben Urbanski" <Click here to reveal e-mail address>
From: "Ben Urbanski" <Click here to reveal e-mail address>
Subject: Auto scrolling a textbox control
Date: Tue, 4 Jun 2002 08:38:44 -0500
Lines: 11
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <uHSyL08CCHA.2172@tkmsftngp04>
Newsgroups: microsoft.public.dotnet.general
NNTP-Posting-Host: 204.52.250.5
Path: cpmsftngxa07!cpmsftngxa08!tkmsftngp01!tkmsftngp04
Xref: cpmsftngxa07 microsoft.public.dotnet.general:53429
X-Tomcat-NG: microsoft.public.dotnet.general

Hello,

Does anyone know how it can auto scroll a textbox control? I'm using one to
display a log to which I append data. I'd like the textbox to scroll down in
pace with the data I'm appending. (I'm developing in C#.)

Thanks,

Ben

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
Ben Urbanski
GOOD ANSWER
Very helpful. Thanks, Lion.

"Lion Shi" <Click here to reveal e-mail address> wrote in message
news:yeLeNYKDCHA.1884@cpmsftngxa07...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
Ryan Martin
GOOD ANSWER
(Type your message here)

--------------------------------
From: Ryan

AppendText works faster and with less code. It will scroll also.
Textbox1.AppendText(sText)
Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
 
System.Web.UI.MobileControls.TextBox
System.Web.UI.WebControls.TextBox
System.Windows.Forms.TextBox




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734