Solved

scroll winforms textbox to last line

Posted on 2006-11-27
5
1,169 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 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