ComponentOne True DBGrid for WinForms
Data Presentation Techniques / Text Formatting / Numeric Field Formatting
In This Topic
    Numeric Field Formatting
    In This Topic

    True DBGrid for WinForms supports a variety of data formatting options through the C1DataColumn object's NumberFormat property. The NumberFormat property reconfigures the data format that is handed to the grid from the database. It can alter most types of numeric values for a particular column.

    For example, to display all date values within a column according to the form 26-Apr-01, use the predefined Medium Date setting:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1TrueDBGrid1.Columns("HireDate").NumberFormat = "Medium Date"
    

    To write code in C#

    C#
    Copy Code
    this.c1TrueDBGrid1.Columns["HireDate"].NumberFormat = "Medium Date";
    

    Note that if the NumberFormat property of a column is changed at run time, the display does not need to refresh since True DBGrid handles this automatically.

    See Also