How can I set the NumericUpDown Control to Infinity?

Viewed 16994

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

4 Answers

Setting any object's maximum to infinty is impossible.

But you can set it to the max value of your computer's capability.

If you want it the largest amount, this should work (depending on your computer's capability again):

nud.Maximum = decimal.MaxValue;

You should get the maximum 79,228,162,514,264,337,593,543,950,335 (that is a very big number!) for your NumericUpDown if you carefully read my answer and tried my sample.

If you're computer can't handle this, try replacing decimal.MaxValue with long.MaxValue (Integer 64-bit), or int.MaxValue (Normal Integer).

Just replace nud with your actual NumericUpDown object name.

Regards,

Me

Related