I am using UltraNumericEditor in UI, using default min/max. In the initialization, I set the value to a negative number. Then it won't display it all. Also it locks the UI, can not tab it out until I input some positive number. I also can not type any negative number in there--that means it does not take "-" sign at all.
Did I miss anything here or how to do make it support negative numbers?
Thanks a lot!
Jisheng Xie
Found the problem. I need to set the MinValue to a negative number, the default value is not working.
Hello,
As far I understand you was able to solve your issue.
Let me know if you have any further questions.
What Mask are you using? Your mask has to start with a minus sign (-) in order to accept negative values.
Hi Mike.
I had set the minvalue of the control to -25.
But when I type in '-', it didn't show any respond. Same with when I clicked on the 'Down' button on the control. It stopped when it reached '0'.
engloon said: I had set the minvalue of the control to -25. But when I type in '-', it didn't show any respond. Same with when I clicked on the 'Down' button on the control. It stopped when it reached '0'.
Okay, but that does not answer my question. What is the InputMask property set to?
I set the MaxValue to 25 and the MinValue to -25 in the code behind.
Hi,
I understand that you have set the MinValue and MaxValue, but that is not what I am asking. I am asking about the MaskInput property.
That makes more sense basically because the odds of a value going that far negative are small we have been getting lucky. Thanks for your response.
Hi Michael,
The difference is the number of digits you can type.
It's hard to see the difference with your example, because you have so many digits, but your users will not be able to enter the minimum value you have assigned. Let's example a simpler example:
MinValue: -99.99
MaxValue: 99.99
MaskInput: "nn.nn"
If you try to enter "-99.99" (the MinValue), you cannot, because there is only space for 3 digits before the decimal point and the minus sign counts as a digit.
If you want to be able to enter the full range of values, you would have to change the MaskInput to "-nn.nn" to allow for the minus sign and the full value "-99.99"
I know this is an old post but didn't see any reason to create a new post.
I am trying to figure out what is best practice for masked input. Currently we do not put a "-" at the front or end of our masked input and it has always accepted a negative sign and displayed it. I guess my question is what is best practice? Is it better to always put the negative at the front of the format or is it no longer necessary?
Here is how we setup numeric editors.
MaskInput "nnnnnn.nnn"
FormatString = "###,##0.000;(###,##0.000);0.000)
MinValue = "-999999.999"
MaxValue = "999999.999"
Currency Editors
MaskInput = "nnnnnn.nn"
FormatString = "C2"
MinValue = "-999999.99"
MaxValue = "999999.99"
I used "-nn" for integer and "-nn.99" for double and it solved the problem.
Thanks for your kind help :)
Okay, so it's using the default mask, which probably does not contain a minus sign. So you need to set the MaskInput to something with a minus sign, like "-nn"