Posted By

pckujawa on 11/19/08


Tagged

gui csharp textBox statusText


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

leonbda
umang_nine


Scroll to the bottom of a text box control programmatically


 / Published in: C#
 

URL: http://bytes.com/forum/thread248500.html

This technique is useful for when you are displaying text back to the user in a GUI and want the most recent text to be displayed at the bottom of the text control, but you want that information to be visible.

Another nice function that works well if you aren’t moving up and down in the text box is the textbox.AppendText function. It will add the text to the bottom and keep the textbox from going to the top. (Thanks to Charlie Mann for that one.)

  1. // Scroll to end of text box
  2. aTextBox.SelectionStart = aTextBox.TextLength;
  3. aTextBox.ScrollToCaret();

Report this snippet  

You need to login to post a comment.