set focus to the next cell of datagridview in c#.net
I have a datagridview in windows forms, the default behavior when editing values is that after the edition of a cell, when I press enter, the selected row changes to the next cell. is it possible???
Shweta LodhaPosted Feb 4, 2014, 2:34 PM
You can capture KeyDown event and select the row on pressing Enter:
void dataGridView_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.dataGridView.CurrentRow.Selected = true;
e.Handled = true;
}
}