I have a windows application with a DataGridView as a data view. Every 2 minutes the grid will be updated with new data. To keep the scrollbar in sync with the newly added data, I have to reset its ScrollBars:
dbv.Rows.Clear();
SCrollBars sc = dbv.ScrollBars;
dbv.ScrollBars = ScrollBars.None;
dbv.ScrollBars = sc;
With the codes above, the scrollbar reappears after updating the data. The problem is that the application needs to install a specific cell selected after the update:
dbv.CurrentCell = dbv[0, selectedRowIndex];
With the code above, the cell is selected; however, the position of the scroll bar does not reflect the position of the selected cell row position. When I try to move the scroll bar after the update, the grid will go to the first row.
, 0 reset. CurrentCell , . , DataGriadView.
:
dbv.CurrentCell = dbv[0, selectedRowIndex];
dbv.FirstDisplayedScrollingRowIndex = selectedRowIndex;
, . , , ?