Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ScrollToRow(int theRow)
- {
- //
- // Expose the protected GridVScrolled method allowing you
- // to programmatically scroll the grid to a particular row.
- //
- if (DataSource != null)
- {
- GridVScrolled(this, new ScrollEventArgs(ScrollEventType.LargeIncrement, theRow));
- }
- }
- // Get current user scroll position
- int scrollPosition = myGridView.FirstDisplayedScrollingRowIndex;
- // Do some work
- ...
- // Rebind the grid and reset scrolling
- myGridView.DataBind;
- myGridView.FirstDisplayedScrollingRowIndex = scrollPosition;
- public void ScrollToRow(int theRow)
- {
- //
- // Expose the protected GridVScrolled method allowing you
- // to programmatically scroll the grid to a particular row.
- //
- if (DataSource != null)
- {
- GridVScrolled(this, new ScrollEventArgs(ScrollEventType.LargeIncrement, theRow));
- }
- }
- Public Sub ScrollToRow(ByVal theRow As Integer)
- '
- ' Expose the protected GridVScrolled method allowing you
- ' to programmatically scroll the grid to a particular row.
- '
- On Error Resume Next
- If Not DataSource Is Nothing Then
- GridVScrolled(Me, New ScrollEventArgs(ScrollEventType.LargeIncrement, theRow))
- End If
- End Sub
- int v= dataGridView1.VerticalScrollingOffset ;
- int h= dataGridView1.HorizontalScrollingOffset ;
- //...reload
- dataGridView1.VerticalScrollingOffset = v;
- dataGridView1.HorizontalScrollingOffset =h;
- int indexOfTopMostRow = HitTest(dataGrid.RowHeaderWidth + 10,
- dataGrid.PreferredRowHeight + 10).Row;
- if(gridEmployees.FirstDisplayedScrollingRowIndex != -1) gridEmployees.FirstDisplayedScrollingRowIndex = 0;
Add Comment
Please, Sign In to add comment