0
votes

I have a datagrid view that loads data from a database. This is unbound datagridview. The columns are Description, UPrice, Quantity and Total

Description UPrice come from database then quantity is typed. I want it so that when my datagrid loads, cursor goes to Quantity column and it is shown blinking like we have in text boxes.

Please advise how to do it. Thanks

2

2 Answers

2
votes

You have to combine these lines to set focus on a cell:

dataGridView1.ClearSelection()

DataGridView1.CurrentCell = DataGridView1.Item("ColumnName", 5)

dataGridView1.BeginEdit(true)
1
votes

you can do like this...

Set the Current Cell like:

DataGridView1.CurrentCell = DataGridView1.Item(1, 5)

or

DataGridView1.CurrentCell = DataGridView1.Item("ColumnName", 5)

and you can directly focus with Editing by:

dataGridView1.BeginEdit(true)

or you can try like this...

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;