System.Windows.Forms.NumericUpDown Class

Represents a Windows spin box (also known as an up-down control) that displays numeric values.

See Also: NumericUpDown Members


public class NumericUpDown : UpDownBase, System.ComponentModel.ISupportInitialize


A System.Windows.Forms.NumericUpDown control contains a single numeric value that can be incremented or decremented by clicking the up or down buttons of the control. The user can also enter in a value, unless the UpDownBase.ReadOnly property is set to true.

The numeric display can be formatted by setting the NumericUpDown.DecimalPlaces, NumericUpDown.Hexadecimal, or NumericUpDown.ThousandsSeparator properties. To display hexadecimal values in the control, set the NumericUpDown.Hexadecimal property to true. To display a thousands separator in decimal numbers when appropriate, set the NumericUpDown.ThousandsSeparator property to true. To specify the number of digits displayed after the decimal symbol, set the NumericUpDown.DecimalPlaces property to the number of decimal places to display.

To specify the allowable range of values for the control, set the NumericUpDown.Minimum and NumericUpDown.Maximum properties. Set the NumericUpDown.Increment value to specify the value to be incremented or decremented to the NumericUpDown.Value property when the user clicks the up or down arrow buttons. You can increase the speed that the control moves through numbers when the user continuously presses the up or down arrow by setting the NumericUpDown.Accelerations property.

When the NumericUpDown.UpButton or NumericUpDown.DownButton methods are called, either in code or by the click of the up or down buttons, the new value is validated and the control is updated with the new value in the appropriate format. Specifically, if the UpDownBase.UserEdit property is set to true, the NumericUpDown.ParseEditText method is called prior to validating or updating the value. The value is then verified to be between the NumericUpDown.Minimum and NumericUpDown.Maximum values, and the NumericUpDown.UpdateEditText method is called.


Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0,