Possible Duplicate:
How do I automatically scroll to the bottom of a multiline text box?
I use a multiline TextBox
to output some information in new lines as it arrives from a BackgroundWorker
.
Can I make it to scroll to the very bottom each time a new line arrives?
By default it seems to do just the opposite - it scrolls to the very first line each time a new line arrives and the Text
property is changed.
Step 1: Create a windows form. Step 2: Drag the TextBox control from the ToolBox and drop it on the windows form. You can place TextBox anywhere on the windows form according to your need. Step 3: After drag and drop you will go to the properties of the TextBox control to set the Multiline property of the TextBox.
// Creating textbox TextBox Mytextbox = new TextBox(); Step 2 : After creating TextBox, set the ScrollBars property of the TextBox provided by the TextBox class.
A multiline text box control is a large text box that can display several lines of text or accept this text from user input. Text boxes are often linked to select value lookups and detailed menus. You can place a multiline text box control within a section control.
A multiline text box allows you to display more than one line of text in the control. If the WordWrap property is set to true , text entered into the multiline text box is wrapped to the next line in the control.
Set the TextBox
properties:
Multiline = True;
ScrollBars = Both;
To auto scroll on the TextChanged
event:
textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With