# 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`.

{% hint style="info" %}
For a full list of properties, methods and events see the [API documentation](https://docs.wisej.com/api/wisej.web/editors/wisej.web.typedtextbox)
{% endhint %}

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](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#standard-format-specifiers)
* [Custom numeric format string](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings)
* [Standard date and time format string](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings#table-of-format-specifiers)
* [Custom date and time format string](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings)

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.

<div align="center"><figure><img src="https://553579532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MF1D11gPs_az3xaKusw%2Fuploads%2F9B1NthajIOSMoHGWWrIh%2Ftrue2.gif?alt=media&#x26;token=3e43d8d6-35e1-4cfb-9523-068c9f0e4cde" alt="TypedTextBox with KeepFormatOnEnter set to true"><figcaption><p>KeepFormatOnEnter = true</p></figcaption></figure> <figure><img src="https://553579532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MF1D11gPs_az3xaKusw%2Fuploads%2F9kNFQ29Fb104XOqehuR4%2Ffalse.gif?alt=media&#x26;token=9b203227-3a74-4f9c-9ef1-fbe2a5dc0ef9" alt="TypedTextBox with KeepFormatOnEnter set to false"><figcaption><p>KeepFormatOnEnter = false</p></figcaption></figure></div>

## How To

### Format text as currency

```csharp
this.textBox.ValueType = typeof(System.Decimal);
this.textBox.CustomFormat = "c";
```

### Format text as date

```csharp
this.textBox.ValueType = typeof(System.DateTime);
this.textBox.CustomFormat = "dd";
```
