I have one textbox in c# window forms that must allow only decimal numbers and minus sign. I need to write the code in textbox_textchanged event
Regards
Angela
I have one textbox in c# window forms that must allow only decimal numbers and minus sign. I need to write the code in textbox_textchanged event
Regards
Angela
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 2, 2013, 11:35 AM
The following should do that.
As well as removing invalid characters, it should also ensure that:
1. There's no more than one decimal point (only the last one entered is retained).
2. If there is a minus sign it's at the start of the string.
3. There's always at least one zero before a decimal point.