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..
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.
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.
Use the DataGridView.FirstDisplayedScrollingRowIndex Property
try this:
dataGridView1.FirstDisplayedScrollingRowIndex = 15;
See the documentation of DataGridView.FirstDisplayedScrollingRowIndex
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With