Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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..

like image 462
Ashish Ashu Avatar asked Sep 17 '09 11:09

Ashish Ashu


People also ask

How to auto scroll DataGridView in c#?

Go to the form's properties then events then the Load event and then press the Enter key. Now go to the DataGridView's properties then events then scroll and then press the Enter key. Now go to the DataGridView properties then events then SelectionChanged and then press the Enter key. Now paste in the code.

What is DataGridView in C#?

The DataGridView control provides a customizable table for displaying data. The DataGridView class allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor.


2 Answers

Use the DataGridView.FirstDisplayedScrollingRowIndex Property

like image 121
BFree Avatar answered Sep 22 '22 08:09

BFree


try this:

dataGridView1.FirstDisplayedScrollingRowIndex = 15;

See the documentation of DataGridView.FirstDisplayedScrollingRowIndex.

like image 23
Khadaji Avatar answered Sep 22 '22 08:09

Khadaji