ComponentOne CalendarView for WinForms
CalendarView for WinForms / Using Controls / DateEdit Features / Value Formatting and Parsing
In This Topic
    Value Formatting and Parsing
    In This Topic


    The DateEdit control allows controlling value formatting through the FormatType property. Its enumerated values define how 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. For information about supported date formats in DateEdit, see Date formats.

    Besides predefined formats, there is custom format that corresponds to the case of a custom format specifier determined by the CustomFormat property. In addition, there is a special format type, UseEvent, which delegates the formatting to the Formatting event. Furthermore, the ability to represent NULL values (System.DBNull) is controlled by the NullText and the EmptyAsNull property. For information about handling null values in DateEdit, see Null value and watermark support.

    Sometimes, it is important to trim leading or trailing spaces when showing formatted values. To trim leading and trailing spaces, set the TrimStart and the TrimEnd property respectively.

    DateEdit supports two formats, one for display (when the control is read-only or is not in the edit mode), and another for edit mode.  The formatting modes are accessible through the DisplayFormat and the EditFormat property.


    Converting the string entered by the user to the data type is called parsing. It is the opposite of formatting. The DateEdit control allows controlling parsing through the ParseInfo property. The ParseInfo property provides access to the ParseInfo Class that contains sub-properties that control different aspects of parsing.

    Though default parsing suffices in a majority of cases, you can still change many aspects of how the control parses, by expanding the ParseInfo property, changing the (Inherit) flags, and setting desired properties. By default, the same format property value is used for parsing as for formatting.

    See Also