Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to prevent Non-Numeric Input in DataGridView ?
Message
From
16/10/2007 23:48:57
Handi Rusli
PT. Alam Sumbervita
Jakarta, Indonesia
 
 
To
16/10/2007 23:40:58
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
01261399
Message ID:
01261403
Views:
9
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."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform