The NumericUpDown control lets the user enter and edit numeric values. You can set the minimum and maximum values as well as the step change made when the spinner is used. The value of the control can also be set by commands from a connected device.

NumericUpDown control properties
Property Access Type Method Description
DecimalPlaces Design-only Integer The number of decimal places to display. See rounding below.
Hexadecimal Design-only bool Indicates whether the control should display its value in hexadecimal
Increment Design-only Decimal The amount to increment or decrement the value on each button click
Name Read only string The name of the control
OnValueChangedSend Design-only string The command to send to your Arduino sketch when the numeric value is changed.
Value Read/write double SetNumber The current value shown in the control. Refer to IntegerValue, DecimalValue and DoubleValue if you are interested in retrieving/setting the control value using a specific type.
IntegerValue Read/write 32 bit integer SetNumber Gets/sets the current control value as a 32 bit integer value.
DecimalValue Read/write Decimal SetNumber Gets/sets the current control value as a Decimal value.
DoubleValue Read/write double SetNumber Gets/sets the current control value as a Double. This can be more convenient for mathematical operations than the Decimal returned by the DecimalValue property.
Minimum Read/write Decimal SetMinimum Gets/sets the minimum control value
Maximum Read/write Decimal SetMaximum Gets/sets the maximum control value
ReadOnly Read/write bool SetReadOnly If true, the user can’t edit the control’s value
ThousandsSeparator Design-only bool Indicates whether the system thousands separator (commonly ‘,’, ‘.’ or ‘ ‘) will be inserted between every three decimal digits
UpDownAlign Design-only LeftRightAlignment Sets whether the spinner is shown on the left or right side of the control

This control also supports all the common control properties.

Rounding

The NumericUpDown control is a double value, even if you set the number of decimal places to zero. This can cause problems when scaling if your Arduino sketch expects an integer value. Use the Tools object to convert values to integers when creating the serial message, if required.

For example: !SetValue [Tools.ToInt(MyNumericUpDown.Value/2)]\r\n. Note: values are rounded towards zero so Tools.ToInt(9/2) and Tools.ToInt(-9/2) return 4 and -4 respectively. To round positive values 0.5 or higher up, use: [Tools.ToInt(MyNumericUpDown.Value/2 + 0.5)].

Start typing and press Enter to search