Skip to main content

FormatInfo.GetDisplayText(Object) Method

Gets the value formatted according to the format pattern and using the format provider settings.

Namespace: DevExpress.Utils

Assembly: DevExpress.Data.v22.2.dll

NuGet Package: DevExpress.Data


public virtual string GetDisplayText(
    object val


Name Type Description
val Object

The value to format.


Type Description

The text representation of the specified value according to settings of the current FormatInfo object.


You can use the GetDisplayText function to format a value passed as the function parameter according to the format pattern and by using the settings of a format provider. The format pattern is specified by the FormatInfo.FormatString property.

The format provider is obtained from FormatInfo.Format.

The FormatInfo.Format provider can be specified implicitly by setting the FormatInfo.FormatType property. This can be useful if you wish to format values based on the current language and regional settings (culture). If you need to format values based on a specific culture, you can assign a format provider to FormatInfo.Format explicitly.

Refer to the FormatInfo.Format for an example.


The code below specifies the format type and format string for a text editor designed to display currency values. For this purpose, the FormatInfo.FormatType and FormatInfo.FormatString properties are used respectively.

However in this example, we use the specified format settings to format a custom value (1099.99) via the FormatInfo.GetDisplayText function. The result ($1,100) is displayed within a label.

    FormatInfo fInfo = textEdit1.Properties.DisplayFormat;
    fInfo.FormatType = FormatType.Numeric;
    fInfo.FormatString = "c0";
    label1.Text = fInfo.GetDisplayText(1099.99);

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetDisplayText(Object) method.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also