# Working with RadMaskedEditBox

The behavior of the control can be defined by setting up some important properties as well as by handling events.

## Properties

**RadMaskedEditBox** descends from RadTextBox and so has the same properties, methods and events. The significant properties unique to **RadMaskedEditBox** are:

* **MaskType:** This property determines how masks are interpreted by the control. Valid values are:

  * **None:** The control acts like a text box.

  * [Numeric:](https://www.telerik.com/products/winforms/documentation/controls/editors/maskededitbox/numeric-masks) You can define [standard](http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx) numeric masks.

  * [Standard:](https://www.telerik.com/products/winforms/documentation/controls/editors/maskededitbox/standard-masks) You can define standard masks

  * **Regex:** You can define [Regex expressions](https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expressions) as masks.

  * **IP:** Predefined mask for IP input.

  * **Email:** Predefined mask for email validation.

  * **DateTime:** Predefined mask for DateTime input.

  * **TimeSpan:** Predefined mask for TimeSpan input. Available since R1 2019.

  * **FreeFormatDateTime:** With that mask type end-users are able to enter a date and time in a wide range of formats without having to conform to a specific mask. In the following article you can find more information how this DateTime parsing logic works: [Parsing Dates](https://www.telerik.com/products/winforms/documentation/controls/editors/maskededitbox/parsing-dates)

* **Mask:** A string of characters that constrain user input. The Mask property may contain literals and special mask characters. The MaskType determines how the mask characters are interpreted. Use the backslash "" character to escape any mask characters so that they display as literals. At runtime, any blank space occupied by a Mask character is displayed as the **PromptChar** property character.

* **PromptChar:** This property represents the character displayed in any blank space defined by a Mask character.  By default the character is an underscore "\_".

* **Culture:** This property allows you to set the current language and culture from a drop down list at design-time or assign a new  **CultureInfo** instance at run-time.

> caption Figure 1: RadMaskedEditBox German Culture

![WinForms RadMaskedEditBox German Culture](https://www.telerik.com/products/winforms/documentation/assets/cfabcb6f89f3fff54ea1095d43ad17bc/editors-maskededitbox-properties-and-events001.png)

```C#
this.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.DateTime;
this.radMaskedEditBox1.Mask = "d";
this.radMaskedEditBox1.Culture = new System.Globalization.CultureInfo("de-de");

```

```VB.NET
Me.RadMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.DateTime
Me.RadMaskedEditBox1.Mask = "D"
Me.RadMaskedEditBox1.Culture = New System.Globalization.CultureInfo("de-DE")
```

* **Value:** This property returns user input without the formatting characters.  If you want the input and the formatting characters, use the **Text** property.

* **NullText:** determines the text that will be displayed, when the **Value** of the control is null.

## Events

**RadMaskedEditBox** allows you to handle **ValueChanging** and **ValueChanged** events. Examine the **Text** and **Value** properties to determine user entry with mask and without mask, respectively. **ValueChanging** also passes a **CancelEventArgs** parameter containing a **Cancel** property. When **Cancel** is set to true the value is not allowed to change.

## MaskType and Mask Examples

| MaskType | Mask                    | User Input    | Displayed as Example        |
| -------- | ----------------------- | ------------- | --------------------------- |
| Standard | # ###                   | 12            | # 12\_                      |
| Standard | ###-##-####             | 1234          | 123-4\_-\_\_\_\_            |
| Standard | aaaaa-aaaaa-aaaaa-aaaaa | abc123        | abc12-3\_\_\_\_-*****-***** |
| DateTime | d                       | 1 1 2007      | 01/01/2007                  |
| DateTime | MMM dd                  | Navigate with | Dec 1                       |

## See Also

* [Standard Masks](https://www.telerik.com/products/winforms/documentation/controls/editors/maskededitbox/standard-masks)
* [Date and Time Masks](https://www.telerik.com/products/winforms/documentation/controls/editors/maskededitbox/date-and-time-masks)
* [Numeric Masks](https://www.telerik.com/products/winforms/documentation/controls/editors/maskededitbox/numeric-masks)
* [Properties, Methods and Events](https://www.telerik.com/products/winforms/documentation/controls/editors/maskededitbox/properties-methods-events)
