Hi, how can I make the DataGridView remainina cell after Enter is pressed to commit an edit? The default behaviour is to move down one cell. The only way that I could make it work was to inherit the DataGridView and overrideProcessCmdKey.When the Enteris pressed,I would move one cell to the left and then back. See code below. This is a hack and I would like a better way of handling it. Also, I am using the DataGridView unbound.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (msg.WParam == new IntPtr(13))
{
this.CurrentCell = this[this.CurrentCell.ColumnIndex-1, this.CurrentCell.RowIndex];
this.CurrentCell = this[this.CurrentCell.ColumnIndex, this.CurrentCell.RowIndex];
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}