Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataGridView - Focus a specific cell

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.

like image 513
SMUsamaShah Avatar asked Feb 07 '11 07:02

SMUsamaShah


1 Answers

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) 
like image 116
CloudyMarble Avatar answered Sep 22 '22 10:09

CloudyMarble