NumericUpDown SafeValue()

public static void SafeValue(this NumericUpDown c, decimal value)
{
   c.Value = Math.Max(c.Minimum, Math.Min(value, c.Maximum));
}
Example:
Use control.SafeValue(42) instead of control.Value = 42.

Description

http://peshir.blogspot.nl/2011/02/safely-set-numericupdown-control-value.html

Details

Double click on the code to select all.

 

;