Prevent clicking off a cell in GDBG

How can I prevent the user from clicking off the cell they are editing, until they either press return or ESC. Thanks,

1 Reply

AD Administrator Syncfusion Team December 2, 2005 01:28 PM UTC

Try handling these two events using the added lastKeyDown field.
 
private Keys lastKeyDown = Keys.None;

private void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
    this.lastKeyDown = e.KeyCode;
}
private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e)
{
    if(lastKeyDown != Keys.Enter && lastKeyDown != Keys.Escape)
        e.Cancel = true;
}

Loader.
Up arrow icon