0

I programmatically edit my datagridview cell values. I use the vertical scrollbar to find the row I want to edit, select the row then click an edit button that takes me to another form where changes to the record are made. I then click a button which saves the changes and returns me to the datagridview form. No problems here.

When I return to the grid, the records are displayed with the first record at the top of the grid. That is, the vertical scroll bar has repositioned itself to the very top.

Is it possible for the datagridview to "remember" the position of the vertical scroll bar so that when I am returned to the grid, the rows displayed are the same as when I left?

Any ideas about how to go about this would be greatly appreciated.

4
Contributors
4
Replies
15
Views
5 Years
Discussion Span
Last Post by fatimaezzahraa.sami
2

See if this helps.

With DataGridView1
            Static iTopRow As Integer
            iTopRow = .FirstDisplayedScrollingRowIndex '// get Top row.
            Form2.ShowDialog()'// Form that edits record.
            .FirstDisplayedScrollingRowIndex = iTopRow '// set Top row.
        End With
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.