Skip to content

CustomFormat Property

Description

Returns or sets a value that specifies the format used by the control when displaying date/time information.

Property Type

Read-write property

Syntax (Visual Basic)

Public Property CustomFormat() As String

Remarks

The CustomFormat property acts as an input mask. To display a custom format, the Format property must be set to xtpPickerCustom.

You can add body text to the format string. For example, if you want the control to display the current date with the format "Today is: Friday July 25, 1997 Time: 8:34 AM", the CustomFormat string is 'Today is:' ddddMMMMdd, yyy ' Time: 'h:mtt. Body text must be enclosed in single quotation marks.

One of the custom format fields described above is a callback field. A callback field allows you to customize output by specifying certain parts of a format string as callback fields. To declare a callback field, you must include one or more 'X' characters (ASCII Code 88) anywhere in the body of the format string. Callback fields are displayed in left-to-right order.

When a new date is displayed in a format that includes one or more callback fields, the Format and FormatSize events are raised for each callback field. You can use the Format event to specify a custom response string, and the FormatSize event to determine the space needed to display the string. This behavior gives you complete control of how a callback field is displayed.

Each sequence of X's has a specific meaning. For example, X might mean "st/nd/rd/th" (for "1st", "2nd", "3rd", or "4th") and "XX" may mean "first", "second", "third", or "fourth". These fields do not format the user's text; they format the date into a displayable format.

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.