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.
Unfortunately, activation email could not send to your email. Please try again.

Prevent clicking off a cell in GDBG

Thread ID:





37930 Dec 2,2005 05:58 AM Dec 2,2005 08:28 AM Windows Forms 1
Tags: GridControl
John Slater
Asked On December 2, 2005 05:58 AM

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

Administrator [Syncfusion]
Replied On December 2, 2005 08:28 AM

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;


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.