# Formatting Data

Learn about formatting data in C1Input.

## Content



**C1Input** controls support a rich formatting model which enables developers to customize the appearance of a control’s text in almost any way imaginable. The main function of formatting is to display a string [Text](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.Text.html) representation of a typed or stored [Value](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.Value.html).

Formatting is controlled by the [FormatType](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.FormatType.html) property, see [Format Types](/componentone/docs/win/online-input/usingthec1inputcontr/formattingdata/formattypes) for details. Its enumerated values define data will be formatted in the control. Some of the options correspond to .NET _standard format specifiers_ for numeric and date-time types, for example, StandardNumber and LongDate, see [Formatting Types](http://msdn2.microsoft.com/en-us/library/fbxft59x(vs.80).aspx) in the .NET Framework documentation.

One FormatType option, CustomFormat, corresponds to the case of a _custom format specifier_ as defined in the .NET Framework documentation, the specifier itself is determined by the [CustomFormat](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.CustomFormat.html) property. For example, CustomFormat property is set to "##,###.###" produces numbers with at most five digits before and three digits after decimal point. See [Custom Format Specifiers](/componentone/docs/win/online-input/usingthec1inputcontr/formattingdata/customformatspecifier) for details.

There is also a special FormatType option, UseEvent, which delegates the formatting to the [Formatting](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.Formatting.html) event.

The ability to represent NULL values (System.DBNull) is controlled by the [NullText](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.NullText.html) and [EmptyAsNull](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.EmptyAsNull.html) properties.

Sometimes you may find it useful to trim leading and/or trailing spaces when showing the formatted value. You can use the [TrimStart](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.TrimStart.html) and [TrimEnd](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.TrimEnd.html) properties for that.

It is possible to specify two different formats, one for display (when the control is read-only or is not in the edit mode), and another for edit mode, see [Value and Text: Displaying, Validating, and Updating Values](/componentone/docs/win/online-input/usingthec1inputcontr/valueandtextdisplayi) to find more information about edit mode.

These two formatting modes are governed by the [DisplayFormat](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.DisplayFormat.html) and [EditFormat](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.C1TextBox.EditFormat.html) properties. By default, both of them inherit from the control’s properties. To assign specific FormatType, CustomFormat or other formatting property (see [FormatInfo](/componentone/api/win/online-input/dotnet-framework-api/C1.Win.C1Input.4.8/C1.Win.C1Input.FormatInfo.html) class) for a specific mode, expand the DisplayFormat or EditFormat nodes, and change the **(Inherit)** flags and set the desired sub-property.

## See Also

[Format Types](/componentone/docs/win/online-input/usingthec1inputcontr/formattingdata/formattypes)

[Custom Format Specifiers](/componentone/docs/win/online-input/usingthec1inputcontr/formattingdata/customformatspecifier)