NumericUpDown
NumericUpDown (Numeric Increment/Decrement)
The NumericUpDown is a specialized control object used for operator entry of a numeric value within a specific range (Minimum/Maximum).
It allows the operator to enter the value in three ways:
- Clicking the Up/Down arrows next to the object.
- Using the arrow keys on the keyboard.
- Typing the number directly into the box.
This object is safer than a TextBox because it strictly enforces numeric input (rejecting letters or special characters) and forces the entered value to remain within the defined Minimum/Maximum range. It is more precise than an HScrollBar because it supports decimal values (e.g., 12.5).
Common Use Cases
- Setpoint Entry: Temperature (e.g., 80.5 °C), Pressure, or Speed settings.
- Parameter Adjustment: Entering a recipe parameter (e.g., “Wait Time: 30 sec”).
- Quantity Entry: Entering integer values, such as production counts.
Basic Configuration and Operation
1. Defining Format and Range (Advanced Panel) The object’s operational logic is defined in the Advanced panel.
- Minimum / Maximum: The lowest and highest numeric limits that can be entered (e.g., 0.0 – 100.0).
- DecimalPlaces: Determines whether the object operates as an integer (0) or supports decimals (1, 2, etc.).
- Increment: The amount the value changes each time an arrow key is pressed (e.g., 0.5).
2. Binding Values (Properties Panel) The numeric value selected by the operator is linked to a SCADA tag via the Value property in the Properties panel.
Properties Panel – Key Properties
Value
- Tag
- Function: This is a two-way link connecting the object’s current numeric value to a tag.
- Read: If the linked tag (e.g., PLC_Temperature_Set) is set to 75.5 by a script or the PLC, the value inside the box automatically updates to 75.5.
- Write: If the operator types 80 into the box or uses the arrows to reach 80, the value 80 is written to the PLC_Temperature_Set tag.
Advanced Panel – Key Properties
- Minimum
- The lowest numeric value that can be entered.
- Maximum
- The highest numeric value that can be entered.
- DecimalPlaces
- Determines how many decimal digits the value will display.
- 0: Integer entry (e.g., 10, 25, 150).
- 1: One decimal place (e.g., 10.5, 25.0).
- 2: Two decimal places (e.g., 10.55, 25.00).
- Increment
- Determines how much the value increases/decreases each time the operator presses the up/down arrows.
- Example: If DecimalPlaces = 1 and Increment = 0.5, the value increases as 10.0, 10.5, 11.0…
- ThousandsSeparator
- If set to True, it displays a thousands separator (dot or comma) for large numbers (e.g., 10,000).
Common Usage Examples
Example 1: Temperature Setpoint
To adjust an oven’s temperature setting between 0.0 and 120.0 degrees with 0.5-degree precision.
- Add a NumericUpDown to the screen.
- Go to the object’s Advanced panel:
- Minimum: 0
- Maximum: 120
- DecimalPlaces: 1 (For one decimal digit)
- Increment: 0.5 (Increase by 0.5 per click)
- Go to the Properties panel:
- Bind Value -> Tag to the Own_Temperature_Setpoint tag.
Result:
- The operator can only enter values between 0.0 and 120.0.
- If they attempt to enter a letter like “A”, the object prevents it.
- If they attempt to enter 130, the object automatically reverts the value to the Maximum (120.0).
- When the arrows are pressed, the value changes in steps: 80.0, 80.5, 81.0, etc.
