Scroll to bottom of C# TextBox [duplicate]
Try putting the code in the Form's Shown event:
private void myForm_Shown(object sender, EventArgs e)
{
txtLogEntries.SelectionStart = txtLogEntries.Text.Length;
txtLogEntries.ScrollToCaret();
}
While the Load
event (occurs before the Form is shown) is processed, there is no form to display yet, and thus no visual state has been established. Scrolling a non-visible control therefore very likely doesn't do anything because—hey, there is nothing to scroll as a scrolling viewport is just a view on the control but not part of its state.
You may have more success with moving the scrolling part into the Shown
event (occurs after the form is first shown) of the form