I use textbox to write the results.
When textbox is multiline property set to true, and when I insert text into it,
I want it to auto scroll to the last line.
Here is a simple way to auto scrolling textbox.
textbox1.SelectionStart = textbox1.Text.Length;Textbox SelectionStart will force the textbox control to select the last part of the text,
textbox1.ScrollToCaret();
textbox1.Refresh();
and ScrollToCaret() function will auto scroll textbox to the end.
dosn't work :-(
ReplyDeleteThanks, it's very useful
ReplyDeleteThanks, it's very useful
ReplyDeleteDoes not work if your TextBox is on another tab ( when using a TabControl )
ReplyDeleteworking successfully, thx
ReplyDeleteAwesome solution!
ReplyDeleteIt works for me. Thanks a lot for putting the solution in such a simple form!
ReplyDelete-NRK
Works, thx
ReplyDeleteThanks. It worked!
ReplyDeleteTextBox1.AppendText() works fater, not blinking and scroll text.
ReplyDeleteTextBox.AppendText() works awesome, and requires just 1 line of code! Thanks a lot!
ReplyDeleteat least for me this line was unnecessary:
ReplyDeletetextbox1.SelectionStart = textbox1.Text.Length;
Somebody suggested TextBox1.AppendText()
but I'm not sure it is designed for this purpose
have to test it and check if there are some drawbacks
muito bom.. obrigado
ReplyDeletevery good.. thanks xD
muito bom.. obrigadoo
ReplyDeletevery good.. thanks ;D
thx =)
ReplyDeleteworks well, thanks.
ReplyDeletetbPositionCursor.Select(tbPositionCursor.Text.Length, 0);
ReplyDeleteEasy as that...
>= .NET 3.0
Source: http://msdn.microsoft.com/en-us/library/ms752349.aspx
Many thanks
ReplyDeleteYou can also use the built-in function for this..
ReplyDeletetextbox1.ScrollToEnd();
thanks it is very help full
ReplyDeleteThanks, it's very useful
ReplyDeleteThis is working but to avoid scroll bar flicker just use:
ReplyDeletetextBox.AppendText(myTextToAdd);
This is working but to avoid scrollbar flicker just use:
ReplyDeletetextBox.AppendText(myTextToAdd);
textBox.AppendText(myTextToAdd);
ReplyDeleteWill give error "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: chunkLength" when myTextToAdd has large text... i.e. 2000 lines
There is no AppendText, nor ScrollToEnd on Compact Framework, Select doesn't seem to work, and authors proposition causes flickering of scrollbar :P
ReplyDelete(GODDAMN CAPTCHA, 7th try)
Thanks a lot! This really helped me. It's strange that I wasn't able to find anything like this offered in Visual Studio 2008. Would be nice to have it in the properties menu of the text box.
ReplyDeleteİ love you man :)
ReplyDeleteMy textBox is named "inputText":
ReplyDeleteinputText.AppendText(charTxt);
inputText.Select(inputText.Text.Length, 0);
inputText.Focus();
thank you very much
ReplyDelete- max