Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP NODEFAULT equivalent in C#?
Message
 
À
19/04/2003 17:59:54
Information générale
Forum:
ASP.NET
Catégorie:
Migration
Divers
Thread ID:
00765703
Message ID:
00779607
Vues:
17
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform