NumericUpDown Control Overview (Windows Forms)
The NumericUpDown control looks like a combination of a text box and a pair of arrows that the user can click to adjust a value. The control displays and sets a single numeric value from a list of fixed numeric-value choices. The user can increase and decrease the number by clicking the up and down arrows, by pressing the UP and DOWN ARROW keys, or by typing a number in the text box part of the control. Clicking the UP ARROW key moves the number toward the maximum; clicking the DOWN ARROW key moves the number toward the minimum.
Because of its versatile functionality, this control is an obvious choice, for example, if you want to create a volume control for a music player application. The NumericUpDown control is used in many Windows Control Panel applications.
The numbers displayed in the control's text box can be in a variety of formats, including hexadecimal. For more information, see How to: Set the Format for the Windows Forms NumericUpDown Control. The key properties of the control are Value, Maximum (default value 100), Minimum (default value 0), and Increment (default value 1). The Value property sets the current number selected in the control. The Increment property sets the amount that the number is adjusted by when the user clicks an up or down arrow. When focus moves off the control, any typed input will be validated against the minimum and maximum numeric values. You can increase the speed that the control moves through numbers, when the user continuously presses the up or down arrow, with the Accelerations property. The key methods of the control are UpButton and DownButton.