Skip to main content

TypedTextBox

Use TypedTextBox to specify the data type of the Value property and let the control parse and format user input. It does not restrict which characters the user types. It supports the types listed below, as well as custom types with a registered TypeConverter.

info

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:

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 remains visible when the TypedTextBox receives focus. When false, formatting hides during editing. For currency input, consider setting KeepFormatOnEnter to false to avoid confusion with currency symbols during typing.

TypedTextBox with KeepFormatOnEnter set to true KeepFormatOnEnter = true TypedTextBox with KeepFormatOnEnter set to false KeepFormatOnEnter = false

How 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";