I have a program that stores data. A form creates a panel with read only text boxes for each result found in my database query. The Form has autoscroll set to True. When the user clicks on a specific record's update button another form opens to handle the update. The first form then clears all controls and redraws them to reflect the update. My Problem: The redrawn form's scrollbar is always at the top. I want the scrollbar to scroll back to its position before the update. Please help.
You can read and set
You can also check
Form.HorizontalScroll.Visible, but the
.value is 0 if it is not visible, so this should be irrelevant.
Don't go over the maximum when recalling, e.g.
frm.HorizontalScroll.Value = Math.Min(SavedValueH, frm.HorizontalScroll.Maximum)
However, Winforms has some problems when the scrollvalue is set through code, see answers to this question.