Wednesday, April 05, 2006 - Posts

WinForm TextBox.AppendText

Apparently this point is commonly overlooked:

Avoid using TextBox.Text += ... construct to build long content.
Use TextBox.AppendText instead. AppendText internally set selection after last character in Textbox and then replace selection with supplied text using SendMessage API. This method is more effective by order of multitude. Note that after AppendText invocation textbox scrolled down to the last line. This is making difference in textboxes with long content (and scrollbar).