3

I am using datagridview to display data from an access database by binding the database like this

      DataGridView.DataSource = dTable;

When i am moving my cursor down by scrolling in the datagridview,when it gets update, the scrollbar automatically goes up and the 1st cell in the row gets highlighted. there are more than 300 rows in the gridview.If i want to see the last scrip it automatically take me up and onemorething the datagridview is updated for every 5 seconds.

I dont want the scroll bar to go up i want my scroll bar where i placed it before after updating also.

Thanks In Advance.

user1447345
  • 171
  • 3
  • 3
  • 11

1 Answers1

1

In this discussion you will find several options:

  1. In the function that refreshes the DataTable, just before refreshing, get the current row (id) and store it in a variable. After refreshing find that row and scroll to it.

  2. You could also store the VerticalScrollingOffset (and HorizontalScrollingOffset) before updating but that will mess up when rows are added or deleted above the current row.

Emond
  • 50,210
  • 11
  • 84
  • 115