How to implement autoscroll in DataGridView?

20,798

Solution 1

Use the DataGridView.FirstDisplayedScrollingRowIndex Property

Solution 2

This one scrolls to the selected row without put it on top.

dataGridView1.CurrentCell = dataGridView1.Rows[index].Cells[0];

Solution 3

try this:

dataGridView1.FirstDisplayedScrollingRowIndex = 15;

See the documentation of DataGridView.FirstDisplayedScrollingRowIndex.

Solution 4

I guess if you select a row programatically, it will scroll to it.

or you can use FirstDisplayedScrollingRowIndex or FirstDisplayedCell member to make it first cell on the top left

Share:
20,798
Ashish Ashu
Author by

Ashish Ashu

Updated on January 22, 2020

Comments

  • Ashish Ashu
    Ashish Ashu over 3 years

    I have datagridview that has 25 to 100 rows. I am performing a task in seperate thread .Each row depicts a single task. I am selecting the row on which task is performing, if suppose the row is 15 which is invisible then I want to move that row to the visible area. It will autoscroll to the selected row..

  • Pavel Shkleinik about 9 years
    if you dynamically add to the table a lot of items this works very slooooow