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
close icon

Make negative number appear inside parentheses?

What property of the DoubleTextBox can I make the negative numbers appear in parentheses, preferably red also?

4 Replies

LA laura September 1, 2015 04:11 PM UTC

I have figured out that if I use CurrencyTextBox then both the parentheses and the foreground being red can be achieved easily.

But unfortunately, CurrencyTextBox does not have properties for minimum decimal places and maximum decimal places.  Some of the input boxes, our clients want to leave the number of decimal places open so they can decide on an individual basis how many decimal places they want to put into the input boxes.  With CurrencyTextBox, I'm having a hard time seeing how this is possible. 

In other words, I would like to make the CurrencyTextBox be able to not have a set number of decimal places so that our clients can put in, say, 3.4 or 3 or 3.45 or 3.456.  They also do not want trailing zeros so setting the decimal places to something big does not work.

Please help?


VJ Victory Jessie Selvam D Syncfusion Team September 2, 2015 12:37 PM UTC

Hi Iaura,

Thank you for using Syncfusion products.

Query #1: What property of the DoubleTextBox can I make the negative numbers appear in parentheses, preferably red also?
We can make the foreground color as Red for negative numbers using NegativeForeground and ApplyNegativeForeground properties in DoubleTextBox. For parentheses, set NumberNegativePattern=0 in DoubleTextBox.NumberFormat property.

Query #2: But unfortunately, CurrencyTextBox does not have properties for minimum decimal places and maximum decimal places. In other words, I would like to make the CurrencyTextBox be able to not have a set number of decimal places so that our clients can put in, say, 3.4 or 3 or 3.45 or 3.456. They also do not want trailing zeros so setting the decimal places to something big does not work.
Currently our CurrencyTextBox doesn't have support for MinimumNumberDecimalDigits and MaximumNumberDecimalDigits so that we cannot remove trailing zeros in decimal places of CurrencyTextBox. We have prepared a sample that tries to meet your requirement in DoubleTextBox and you can download it from the following link,

Sample: DoubleTextBox_Support

Please let us know if you need further assistance on this.

Regards,
Jessie


LA laura September 2, 2015 02:42 PM UTC

Thank you, good sir.  Your provided sample works perfectly to what we need.


VJ Victory Jessie Selvam D Syncfusion Team September 3, 2015 05:01 AM UTC

Hi Iaura,

Thank you for your update.

Please let us know if you have any query.

Regards,
Jessie

Loader.
Live Chat Icon For mobile
Up arrow icon