DataGridView - Focus a specific cell

后端 未结 10 1407
陌清茗
陌清茗 2020-12-03 00:54

How to set focus on any specified cell in DataGridView? I was expecting a simple way like Focus(rowindex,columnindex) but it is not that easy.

10条回答
  •  北海茫月
    2020-12-03 01:19

    you can set Focus to a specific Cell by setting Selected property to true

    dataGridView1.Rows[rowindex].Cells[columnindex].Selected = true;
    

    to avoid Multiple Selection just set

    dataGridView1.MultiSelect = false;
    

提交回复
热议问题