tags:

views:

183

answers:

4

I'd like to set the max value in the Winforms NumericUpDown control to infinity. How can I do this?

+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
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
A: 

How to set it to infinity, if the value field only offers a decimal as return value?

Heiko Hatzfeld
A: 

Check out the Sine on codeplex.com you can do something like this:

BigNum x = 100;
BigNum xPow100 = x.Pow( 100 );
Console.WriteLine("100^100 == " + xPow100.ToString() );

But it's still cannot be infinity. The size of your RAM is your limitation.

Vadim
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