Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to prevent Non-Numeric Input in DataGridView ?
Message
From
17/10/2007 09:53:35
 
 
To
16/10/2007 23:48:57
Handi Rusli
PT. Alam Sumbervita
Jakarta, Indonesia
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
01261399
Message ID:
01261464
Views:
10
No, sorry it is not. I should have paid closer attention. See if the information at the bottom of this helps you:

http://msdn2.microsoft.com/en-us/library/ykdxa0bc.aspx


>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
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform