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

CurrencyTextbox control & negative values

Thread ID:





3316 Mar 12,2003 11:06 AM Mar 24,2003 01:57 PM Windows Forms 3
Tags: Tools
Jamie Hill
Asked On March 12, 2003 11:06 AM

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 12:48 PM

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 09:46 AM

That works great. Thank you very much.

Jamie Hill
Replied On March 24, 2003 01:57 PM

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.

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.