In a MultiLine textbox when a large amount of text is put into, a scrollbar appears if the scrollbar property has been set to vertical. But by default the scrollbar maintains its position at top no matter how long the text content is. If you want to programmatically keep the scrollbar down to the last entered text , then use the SelectionStart and ScrollToCaret(). They are found in the namespace System.Windows.Forms SelectionStart Property
ScrollToCaret() Method
|
Example
txtTextBoxID.SelectionStart = txtTextBoxID.Text.Length;
txtTextBoxID.ScrollToCaret();
The first line will set the SelectionStart value to the length of the text inside the textbox and then the ScrollToCaret method will scroll the scrollbar such that, that caret will come to visible.
* These properties are Windows Form feature and not available for System.Web.UI i:e for Webcontrols.
|