Reputation: 14667
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..
Upvotes: 7
Views: 24190
Reputation: 1659
This one scrolls to the selected row without put it on top.
dataGridView1.CurrentCell = dataGridView1.Rows[index].Cells[0];
Upvotes: 6
Reputation: 2167
try this:
dataGridView1.FirstDisplayedScrollingRowIndex = 15;
See the documentation of DataGridView.FirstDisplayedScrollingRowIndex
.
Upvotes: 6
Reputation: 1220
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
Upvotes: 3