Format Property
Description
The Format property gets or sets the date format.
Property Type
Read-write property
Syntax (Visual Basic)
Public Property Format() As String
Remarks
Valid date format string flags:
m- Month as decimal number (01-12)d- Day of month as decimal number (01-31)%Y- Year with century, as decimal number
For example, the format string for 05/22/2004 is "%m%d%Y".
Example
PropertyGridItemDate Sample (Visual Basic)
This sample illustrates how to add an item of type PropertyItemDate to your grid.
'*********************************************************************
' PropertyItemDate Example
'*********************************************************************
Dim DateItem As PropertyGridItemDate
' Adds a date item with an initial date of 01/31/2005
Set DateItem = Category.AddChildItem(PropertyItemDate, "DateItem", "01/31/2005")
' Sets date format to MM/DD/YYYY
DateItem.Format = "%m%d%Y"
' Returns the currently set date formatted with the mask MM/DD/YYYY
Debug.Print "Currently set date (MM/DD/YYYY): " & DateItem.Value
' Returns the currently set date without a format mask
Debug.Print "Unformatted date (MMDDYYYY): " & DateItem.MaskedText
' Returns the date using the Month, Day, and Year properties
Debug.Print "Current Date: " & DateItem.Month & "/" & DateItem.Day & "/" & DateItem.Year
See Also
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.