Click here to Skip to main content
15,920,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All

I am using tab button to move next cell in datagridview but after checking a condition
if(gdv.Rows[gdv.CurrentRow.Index].cells[3].Value==""). I want to be back on previous cell.

please any one let me know how to achieve it.

What I have tried:

this.gdv.CurrentCell = this.gdv.Rows[gdv.CurrentRow.Index].Cells[2]
Posted
Updated 9-Oct-17 21:28pm

1 solution

The below code should help you to achieve what you want..

DataGridView1.CurrentCell = DataGridView1.Rows[rowindex].Cells[columnindex]
or

DataGridView1.CurrentCell = DataGridView1.Item("ColumnName", 5)
and you can directly focus with Editing using below code:

dataGridView1.BeginEdit(true)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900