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

Handling Enter Key Event

Thread ID:





915 Sep 3,2002 03:12 PM UTC Sep 4,2002 06:35 AM UTC WinForms 3
Tags: GridControl
Trevor Redfern
Asked On September 3, 2002 03:12 PM UTC

I'm trying to get when the user presses the enter key when the grid has the focus. There is no editing going on, and I tried specifying EnterKeyBehavior to None, hoping that that would pass the enter through the key down event. But nothing doing. Is there some other property or event that needs to be handled in order to catch this?

Clay Burch [Syncfusion]
Replied On September 3, 2002 05:31 PM UTC

Try catching the CurrentCellKeyDown event.

Trevor Redfern
Replied On September 3, 2002 07:49 PM UTC

Well, actually, I am handling that event and not receiving anything. Yes that event seems to work fine when you allow the CurrentCellActivating event to fire. The thing is though I don't want the CurrentCellActivating to fire, so I set the cancel flag to true, but then I can't catch the enter key. Some of the other keys work fine, such as Delete, or any alpha numeric key. These come through loud and clear, but the enter key is lost forever. > Try catching the CurrentCellKeyDown event.

Clay Burch [Syncfusion]
Replied On September 4, 2002 06:35 AM UTC

If there is no currentcell, then I think you will have to subclass your GridControl, and override a method like ProcessCmdKey to catch Enter in this case. public class MyGridControl : GridControl { protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) { if(keyData == Keys.Enter) Console.WriteLine("ProcessCmdKey - Enter"); return base.ProcessCmdKey(ref msg, keyData); } }


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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon