Showing posts with label textbox autoscroll. Show all posts
Showing posts with label textbox autoscroll. Show all posts

Friday, July 6, 2007

Making Textbox control autoscrollable

If text is appended every time, we can do this way:

txtBx->AppendText(strToAppend);
txtBx->Focus();
txtBx->ScrollToCaret();

If text is completely loaded from the beginning to the end every time, it can be done this way:

txtBx->Text = strContent;
txtBx->Focus();
txtBx->SelectionLength = 0;
txtBx->SelectionStart = txtBx->Text->Length;
txtBx->ScrollToCaret();

In either case, Focus method is indispensable.