Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have a textbox on windows form. The Value must then be in the range [0..99999,999] !! Therefore it should not be possible to enter or accept a value > 99999,999 like 123456748 !
Moreover only 1 time Decimal Separator is possible.

Thanks & Regards,

What I have tried:

I tried to set the max value with max length but not able to show the separator .
Posted
Updated 9-Feb-17 19:51pm
Comments
Michael_Davies 10-Feb-17 1:54am    
Why not use a NumericUpDown control?

1 solution

For this you should customize your TextBox - create your own myTextBox which derives from TextBox.
In this TextBox you Override the OnKeyPress-Method and enhance it with your requirement.
For example could you check if a valid key is pressed, but also if the entered string (it's value) doesn't exceeds the given Limits.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900