Ashish Ashu
Ashish Ashu

Reputation: 14667

How to implement autoscroll in DataGridView?

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

Answers (4)

IgorOliveira
IgorOliveira

Reputation: 1659

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

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

Upvotes: 6

Khadaji
Khadaji

Reputation: 2167

try this:

dataGridView1.FirstDisplayedScrollingRowIndex = 15;

See the documentation of DataGridView.FirstDisplayedScrollingRowIndex.

Upvotes: 6

Ahmed Khalaf
Ahmed Khalaf

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

Related Questions