How do I make the DataGridView show the selected row?

后端 未结 9 1226
傲寒
傲寒 2020-12-07 18:17

I need to force the DataGridView to show the selected row.

In short, I have a textbox that changes the DGV select

9条回答
  •  执笔经年
    2020-12-07 18:48

    Please note that setting FirstDisplayedScrollingRowIndex when your DataGridView is not enabled will scroll the list to desired row, but scrollbar will not reflect its position. Simpliest solution is re-enabling and disabling your DGV.

    dataGridView1.Enabled = true;
    dataGridView1.FirstDisplayedScrollingRowIndex = index;
    dataGridView1.Enabled = false;
    

提交回复
热议问题