How do i use DateTimePicker control?

Represents a Windows control that allows the user to select a date and a time and to display the date and time with a specified format.

Namespace: System.Windows.Forms

The DateTimePicker control is used to allow the user to select a date and time, and to display that date and time in the specified format. You can limit the dates and times that can be selected by setting the MinDate and MaxDate properties.

You can change the look of the calendar portion of the control by setting the CalendarForeColor, CalendarFont, CalendarTitleBackColor, CalendarTitleForeColor, CalendarTrailingForeColor, and CalendarMonthBackground properties.

The Format property sets the DateTimePickerFormat of the control. The default date Format is DateTimePickerFormat.Long. If the Format property is set to DateTimePickerFormat.Custom, you can create your own format style by setting the CustomFormat property and building a custom format string. The custom format string can be a combination of custom field characters and other literal characters. For example, you can display the date as "June 01, 2001 - Friday" by setting the CustomFormat property to "MMMM dd, yyyy - dddd".

To use a spin button control (also known as an up-down control) to adjust the date/time value, set the ShowUpDown property to true. The calendar control will not drop down when the control is selected. The date and time can be adjusted by selecting each element individually and using the up and down buttons to change the value.

Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*