Windows Forms Numeric TextBox (SfNumericTextBox) Overview
27 Jul 20212 minutes to read
The NumericTextBox control is an advanced text box control that allows you to enter numeric values in a specific format such as numeric, currency, and percent. It also provides support to display value with custom units.
Key Features
Different modes - Supports specific modes such as numeric, currency, and percent.
Value range support - Allows us to define and validate the value based on minimum and maximum values.
Formatting - Supports to format the value as users need.
Hide trailing zeros - Supports hiding trailing zeros.
Watermark - Supports to display watermark text when value is null.
Custom units - Supports to display values with custom units that can be appended as prefix or suffix.
Choose between different textbox controls
Syncfusion WinForms suite comes up with the following different textboxes:
SfNumericTextBox
The SfNumericTextBox control is an advanced textbox that allows you to enter numeric values in a specific format such as value. The currency or percent value can also be displayed with custom units. Supports hiding trailing zeros and displaying values with custom units.
CurrencyTextBox
CurrencyTextBox is a textbox-derived control that implements all functionalities to format currency input and validation. Provides support for clipboard operations that are compatible with currency data.
PercentTextBox
PercentTextBox is a textbox-derived control that can display double data type values in percentage. It supports display and collection of percentage values.
IntegerTextBox
IntegerTextBox is derived from the Windows Forms Framework TextBox control. Displays integer data type values alone.
SfNumericTextBox vs existing numeric textbox controls
Both SfNumericTextBox and existing numeric textbox controls (IntegerTextBox, PercentTextBox, and CurrencyTextBox) are used for the same purpose. But, the SfNumericTextBox control offers rich set of features over existing numeric textbox controls (IntegerTextBox, PercentTextBox, and CurrencyTextBox). To hide by trailing zeros and prefix or suffix and watermark text, use SfNumericTextBox.
The list of some specific API differences between SfNumericTextBox and existing numeric textbox controls (IntegerTextBox, PercentTextBox, and CurrencyTextBox) is as follows.
SfNumericTextBox |
IntegerTextBox, PercentTextBox and CurrencyTextBox |
Description |
Value | Text | Displays the values in textbox. |
WatermarkText | AllowNull | Sets the null value in textbox. |
MaxValue | MaxValue | Sets the maximum value in textbox. |
MinValue | MinValue | Sets the minimum value in textbox. |
Style.BorderColor | BorderColor | Applies the color of textbox border. |
ThemeName | Style | Applies the visual styles. |
PositiveForeColor | PositiveColor | sets the color only in positive values. |
NegativeForeColor | NegativeColor | sets the color only in negative values. |
ZeroForeColor | ZeroColor | sets the color only in zero values. |
The list of features in SfNumericTextBox over existing numeric textbox controls (IntegerTextBox, PercentTextBox, and CurrencyTextBox) is as follows.
Feature |
Description |
Different modes | Supports specific modes like numeric, currency, and percent. To learn more about different modes in SfNumericTextBox, refer to . |
Formatting | Formats the value based on the user needs. To learn more about format modes in SfNumericTextBox, refer to . |
Hide trailing zeros | Hides trailing zeros. To learn more about hiding zeros in SfNumericTextBox, refer to . |
Custom units | Displays the values with custom units which can be appended prefix or suffix. To learn more about custom units in SfNumericTextBox, refer to . |