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.

How do I trap for "Enter" in a ButtonEdit Control

Thread ID:





17217 Aug 3,2004 06:04 PM Aug 4,2004 10:49 AM Windows Forms 2
Tags: Tools
Administrator [Syncfusion]
Asked On August 3, 2004 06:04 PM

I''m trying to trap the enter key so that I can validate what was inputed in the Textbox when the user pressed the Enter Key. I tried using the KeyPress, KeyDown, KeyUp and none of those events where triggered. Any help would be appreciated. Thank you, Javier

Administrator [Syncfusion]
Replied On August 3, 2004 10:34 PM

Hi Javier, You would have to derive from the ButtonEdit control to create a custom ButtonEdit control and then override its ProcessCmdKey method as shown below : public class CustomButtonEdit : ButtonEdit { public CustomButtonEdit () : base() { } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == (Keys.Enter)) { MessageBox.Show("ButtonEdit Validated!"); return true; } return base.ProcessCmdKey (ref msg, keyData); } } Please refer to the complete sample that illustrates this and let me know if it meets your requirements. We appreciate your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Administrator [Syncfusion]
Replied On August 4, 2004 10:49 AM

Perfect....thank you very much....


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.