I have a Panel with scrollbars, and I frequently want to programmatically scroll a control into view. For reasons that don't bear mentioning I need my own methods. Frequently when I try to set
MyPanel.HorizontalScroll.Value = newScrollValue;
the value simply won't take. I can check MyPanel.HorizontalScroll.Value
immediately after the set, and its value is unchanged. The values that I'm trying to set are definitely within the Minimum and Maximum range.
Now here's the worst part. I found out (don't ask how) that if I make the same set twice in a row, that fixes the problem most of the time. I really do have
MyPanel.HorizontalScroll.Value = newScrollValue;
MyPanel.HorizontalScroll.Value = newScrollValue;
and that really does mostly resolve the issue. But the issue persists when I'm programmatically scrolling to a control in an extremal corner of MyPanel. I tried setting the value three times and no dice.
Does anyone know what's going on or how to fix it? I mostly want to resolve the lingering issue.
~~~~~~
Edit: the lingering problem turned out to be a simple bug and I fixed it. The double-set fixes the problem in all cases. I would still like to know if anyone knows why the first set doesn't take, or if there's a more elegant way to fix the problem than the double-set.