TypedTextBox
The TypedTextBox in Wisej.NET allows users to specify the data type of the Value property, handling parsing and formatting of user input seamlessly. While it doesn't restrict typing, it supports a wide range of types, including custom ones with a registered TypeConverter.
For a full list of properties, methods and events see the API documentation
Override parsing and formatting using the CustomFormatChanged, Format, and Parse events.
Set CustomFormat to a .NET format string. Reference the .NET documentation:
- Standard numeric format string
- Custom numeric format string
- Standard date and time format string
- Custom date and time format string
The ValueType determines the Value property type: System.String, System.DateTime, System.Int32, System.Int64, System.Boolean, System.Decimal, System.Double, or System.Single.
When KeepFormatOnEnter is true, formatting persists when users press enter or click within the TypedTextBox. When false, formatting hides during editing. For currency input, consider setting KeepFormatOnEnter to false to avoid confusion with currency symbols during typing.
KeepFormatOnEnter = true
KeepFormatOnEnter = falseHow To
Format text as currency
this.textBox.ValueType = typeof(System.Decimal);
this.textBox.CustomFormat = "c";
Format text as date
this.textBox.ValueType = typeof(System.DateTime);
this.textBox.CustomFormat = "dd";