DataGridView - Focus a specific cell

后端 未结 10 1422
陌清茗
陌清茗 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:10

    the problem with datagridview is that it select the first row automatically so you want to clear the selection by

    grvPackingList.ClearSelection();
    dataGridView1.Rows[rowindex].Cells[columnindex].Selected = true;  
    

    other wise it will not work

提交回复
热议问题