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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CurrencyTextbox control & negative values

Thread ID:





3316 Mar 12,2003 04:06 PM UTC Mar 24,2003 06:57 PM UTC WinForms 3
Tags: Tools
Jamie Hill
Asked On March 12, 2003 04:06 PM UTC

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?

Davis Jebaraj [Syncfusion]
Replied On 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

Jamie Hill
Replied On March 19, 2003 02:46 PM UTC

That works great. Thank you very much.

Jamie Hill
Replied On 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.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon