Autoscrolling in a DataGridView

Is it possible to autoscroll when I add a value to the cell below the last visible row in the form? I cannot find any autoscroll properties in the DataGridView. The only possible way to do this is to find the index of the last visible cell and change FirstDisplayedScrollingRowIndex?

+4
source share
3 answers

You can use the FirstDisplayedCell property to display this cell.
Since you know which cell you added the value to, you can do it like this:

 dataGridView1.FirstDisplayedCell = yourCell 
+5
source

You can also try,

 gv.FirstDisplayedCell = gv.Rows[gv.Rows.Count - 1].Cells[0]; 
+1
source

These 3 lines are really equivalent to auto scroll down

 System.Int16 i_NotDisplayableRowCount = dataGridView1.RowCount - dataGridView1.DisplayedRowCount(false); // false means partial rows are not taken into acount if (i_NotDisplayableRowCount > 0) dataGridView1.FirstDisplayedScrollingRowIndex = i_NotDisplayableRowCount; 
+1
source

All Articles