Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP NODEFAULT equivalent in C#?
Message
 
To
19/04/2003 17:59:54
General information
Forum:
ASP.NET
Category:
Migration
Miscellaneous
Thread ID:
00765703
Message ID:
00779607
Views:
18
Hi Bonnie,

BTW is this type of functionality available for *All* events. I ask this because I have only seen the Handled property in the KeyEventArgs and KeyPressEventArgs classes.

Is it possible to achive this with other events such as click, etc?

Thanks in advance.



>> Nelson,

You *can* handle a KeyPress event in a sub-class of a TextBox:

// In the sub-class's Contstructor:
this.KeyPress += new KeyPressEventHandler(this.KeyPressHandler);

// and then the Handler:
protected virtual void KeyPressHandler(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.PageDown)
{
// or whatever it is you're checking for, handle it here and then include this:
e.Handled = true;
}
}

For KeyPresses that you don't handle, e.Handled will not be true and C# will process the KeyPress as normal.
"If glory comes after death, I have no hurry"
Marcial
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform