Question Panel scrollbar resets to top after setting position value.

Mugsy

Member
Joined
Sep 30, 2020
Messages
16
Programming Experience
10+
I've written a program that displays a form inside a panel/window.

When I automatically set the VerticalScroll.Value, the contents moves, but the scrollbar resets to the top. This screws things up the next time it's set.

Is there a way to fix this? (PS: Just updated to VS v17.7.0 so I don't know if this bug is old or new.)

Example:
        Dim intFormPos As Integer = 0
        intFormPos = pnlMain.VerticalScroll.Value   ' Record current position of scrolled window before preview goes away and form scrolls.
        [....]
        If intSlots = 200 Then pnlMain.VerticalScroll.Value = intFormPos ' Set it right back.
TIA
 
Last edited:
Back
Top