We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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.
Live Chat Icon For mobile
Up arrow icon