Solved

scroll winforms textbox to last line

Posted on 2006-11-27
5
1,182 Views
Last Modified: 2012-06-27
Hi

I have a multiline textbox I am adding text to, how can I make it scroll to the end of the text?
0
Comment
Question by:zattz
  • 2
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
Kinger247 earned 63 total points
ID: 18019641
Hi Zattz,

Use this code :

TextBox2.SelectionStart = TextBox2.Text.Length
TextBox2.ScrollToCaret()
0
 
LVL 43

Assisted Solution

by:TimCottee
TimCottee earned 62 total points
ID: 18019653
Hi zattz,

With TextBox1
        .SelectionStart = .TextLength 'Move the insertion point to the end of the text
        .ScrollToCaret() 'Move the scroll position to the current insertion point
        .Focus() 'Focus on the textbox (if we have clicked a button to do this for example).
End With

Tim Cottee
0
 

Author Comment

by:zattz
ID: 18019929
Dosn't work...

0
 
LVL 43

Expert Comment

by:TimCottee
ID: 18019964
zattz,

Which one? What happens? Is this being run from a button or some other event?

Tim
0
 

Author Comment

by:zattz
ID: 18020064
I do apologise. It does work.

I never noticed I was adding something else to the text after moving the caret...
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question