user3302467
user3302467

Reputation: 63

Automatically set the scroll to end of file?

I wasn't sure if this was possible or not... I have a couple of live error logs displaying to the user, I would like to place the scroll bar at the end of the file so they can see the last entry (most current) entry in the log.

Is this possible? And if so how would I go about doing this?

I figured it would just be a nice feature to have.

Upvotes: 0

Views: 95

Answers (1)

Menelaos Vergis
Menelaos Vergis

Reputation: 3945

Guessing that this is winforms and you are using TextBox to show your logs

void ScrollToBottom()
{
   txtLogEntries.SelectionStart = txtLogEntries.Text.Length;
   txtLogEntries.ScrollToCaret();
}

Upvotes: 1

Related Questions