Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to prevent Non-Numeric Input in DataGridView ?
Message
De
16/10/2007 23:48:57
Handi Rusli
PT. Alam Sumbervita
Jakarta, Indonésie
 
 
À
16/10/2007 23:40:58
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01261399
Message ID:
01261403
Vues:
11
Is that code is working on DataGridView Control ? I've been tried to use that code in DataGridView but no luck ...

Thanks :-)

>Try something like (if you want to force numeric instead, change to ! to force numeric or use char.IsNumeric):
>
>public class NumbersOnlyTextBox : TextBox
>{
>  public NumbersOnlyTextBox()
>  {
>    KeyPress += new KeyPressEventHandler( HandleKeyPress );
>  }
>
>  private void HandleKeyPress( object sender, KeyPressEventArgs e )
>  {
>    if ( ( char.IsDigit( e.KeyChar ) || char.IsControl( e.KeyChar ) ) )
>      e.Handled = true;
>  }
>}
>
>
>>Hi all,
>>
>>I want to prevent non-numeric input from the first user's keystroke in DataGridView (mimic behaviour of Numeric TextBox in VFP).
>>
>>Anybody know how to do it ?
>>
>>Thanks in advance :-D
Handi Rusli
"Treat people with respect and courtesy, and one will be blessed. Complete task heartily, with best effort and responsibility, and one can achieve the greatest."
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform