Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scroll multiline textbox programatically

Status
Not open for further replies.

WebStar

Programmer
May 1, 2002
69
0
0
DE
Hi,
I have a multiline textbox in wich I enter lines programatically. What I want is that the user allways see the last line, so everytime I enter a line I should scroll the control down. How can I do that?
Thank you!
 
Hi WebStar,

After you add a line to the textbox, execute this code as well (assuming your textbox is called 'myTextBox'):
Code:
myTextBox.SelectionStart = myTextBox.Text.Length;
myTextBox.ScrollToCaret();

This will set the cursor position at the last character in the textbox and then scroll to that position.

Hope this helps!

regards,
Blaxo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top