I've got a chunk of C# code that is supposed to set VerticalScroll.Value within a class that inherits from UserControl. It gets called when any child object of the class changes sizes. The class has its AutoScroll property set to true.
public void ScrollTo(int top)
{
if (top >= this.VerticalScroll.Minimum && top <= this.VerticalScroll.Maximum)
{
this.VerticalScroll.Value = top;
}
}
The problem is, when tracing through the code, sometimes this.VerticalScroll.Value gets set, sometimes it keeps the value that it had before this method was called.
Is this a bug in VS, or are there known conditions under which the value will ignore attempts to set it?
Thanks, Rob