I'd like to set the max
value in the Winforms NumericUpDown
control to infinity
. How can I do this?
views:
183answers:
4
+9
A:
Don't think you can, but could do:
nmrUpDown.Maximum = decimal.MaxValue;
Which sets maximum allowed value to 79,228,162,514,264,337,593,543,950,335
JDunkerley
2009-09-16 11:53:21
Yep, that's the only way, considering (a) the NumericUpDown control value is designed to be always constrained between two values, and (b) the values are of type Decimal which doesn't support infinity.
Christian Hayter
2009-09-16 12:13:38
A:
How to set it to infinity, if the value field only offers a decimal as return value?
Heiko Hatzfeld
2009-09-16 12:03:47
A:
You might consider to create your own user control that mimics the behaviour of a numeric up down. Simply use a TextBox and a vertical scroll bar (VScrollBar) and do some validation.
As your data type you could use a double, that would also format as "+/-Infinity"
if the value exceeds the range.
Frank Bollack
2009-09-16 13:01:24