TypedTextBox

Allows the user to enter a typed value

You can use the TypedTextBox to define the type of Value property to which the text should be parsed, a.NET format string (standard or custom), and whether the formatted string should be preserved when editing or removed when entering the editor.

For a full list of properties, methods and events see the API documentation

You can take over the parsing and formatting using the CustomFormatChanged, Format and Parse events.

CustomFormat can be set to a .NET format string. For examples, consult the .NET documentation in the following links:

ValueType determines the Type of the Value of the TypedTextBox- ie System.String, System.DateTime, System.int32, System.Int64, System.Boolean, System.Decimal, System.Double or System.Single.

If KeepFormatOnEnter is true, the format will be kept when the user presses enter or clicks to move the cursor within the TypedTextBox. If false, the format is not shown while the user is editing the contents of the TypedTextBox. When working with currencies, you may want to set KeepFormatOnEnter to false so the user is not confused by the currency symbol in the text as they are typing.

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

Last updated