PePe Posted April 29, 2005 Posted April 29, 2005 Can someone help with the correct syntax for overriding the Keydown event of a textbox control? I'm having a heck of time getting it to compile. (Yup,..it's friday.) Thanks in advance. PePe public class cTextBox: System.Windows.Forms.TextBox { public cTextBox() { base.KeyDown += new System.EventHandler(OnKeyDown); } protected override void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { //trap escape key here. } } Quote
PePe Posted April 29, 2005 Author Posted April 29, 2005 Here's the correct syntax... public class cTextBox: System.Windows.Forms.TextBox { public cTextBox() { } protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e) { //trap escape key here. MessageBox.Show("hello"); } } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.