DataGridView - Focus a specific cell
Solution 1:
Set the Current Cell like:
DataGridView1.CurrentCell = DataGridView1.Rows[rowindex].Cells[columnindex]
or
DataGridView1.CurrentCell = DataGridView1.Item("ColumnName", 5)
and you can directly focus with Editing by:
dataGridView1.BeginEdit(true)
Solution 2:
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;
Solution 3:
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