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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Prevent clicking off a cell in GDBG

Thread ID:





37930 Dec 2,2005 10:58 AM UTC Dec 2,2005 01:28 PM UTC WinForms 1
Tags: GridControl
John Slater
Asked On December 2, 2005 10:58 AM UTC

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 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;


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon