We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

CurrencyTextbox control & negative values

Is there a way to prevent negative values from being entered into this control? I have need of a numeric textbox that cannot allow a negative value. I can convert the value back to positive inside the TextChanged event, but the CurrencyNegativePattern is still adding the formatting for a negative value. Any ideas?

3 Replies

DJ Davis Jebaraj Syncfusion Team March 14, 2003 05:48 PM UTC

Hi, The CurrencyTextBox control does not provide a property or method to prevent non negative values. This can be achieved by deriving from the CurrencyTextBox control and overriding ProcessCmdKey and Text property. I have attached a sample to this message that shows this method. Regards, Davis


JH Jamie Hill March 19, 2003 02:46 PM UTC

That works great. Thank you very much.


JH Jamie Hill March 24, 2003 06:57 PM UTC

I also found a workaround for this. You can change the negative color to be the same as the positive color, set the CurrencyNegativePattern to 1, and set the NegativeSign property to nothing and it will not change any formatting when negative values are entered.

Loader.
Live Chat Icon For mobile
Up arrow icon