I add control to datagridview after doubleclick (rough code):
DoubleClick
{
datagridview.Controls.Add(newControl);
datagridview.ClearSelection(); //to be shure that any of cells are selected
newControl.Focus();
newControl.KeyUp += new KeyEventHandler(newControl_KeyUp);
}
and:
newControl_KeyUp(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab || e.KeyCode == Keys.A)
{
Commit();
}
}
My new control reacts on Keys.A . but It doesn’t react on tab and enter.
When I click enter or tab, only datagridview selected cell changes.
Since Tab key make focus move, I will recommend you to work on a lower level if you can: