libzz
libzz

Reputation: 640

How to autoscroll in C#

How do you autoscroll the scrollbar in C# (and not permanently)?

Like for example, when I update something in the object in which the scroll bar is assigned, I want it to automatically scroll to the rightmost side.

I tried:

pnlGraph.HorizontalScroll.Value = pnlGraph.HorizontalScroll.Maximum;

but it becomes permanent to the Maximum value.

Any answers to this?

Upvotes: 0

Views: 1246

Answers (1)

dwerner
dwerner

Reputation: 6602

Don't assign the scroll value in the paint event. Doing that ensures that the max value is set every time it is painted, so it remains 'permanent', as you say.

Upvotes: 1

Related Questions