Visual C#

Windows Control: The Date Picker Control

The Date and Time Picker is a control that allows the user to select either a date or a time value. This control provides two objects in one:

1 min read158 words

Introduction to the Date Picker Control#

Using the Date and Time Picker control, users are able to choose specific times or dates. This control effectively combines two distinct functionalities into a single interface element:

One of the advantages of the Date and Time Picker control is that it allows the user to select a time or a date value instead of typing it. This tremendously reduces the likelihood of mistakes.

Creating a Date/Time Picker#

You can implement a Date or Time Picker by placing a DateTimePicker control onto a container like a form. This control is an instance of the DateTimePicker class. It serves as a dual-purpose component; you simply decide whether it should function for date selection or time selection.

Introduction to the Date Picker#

Once the DateTimePicker is on your form, you can restrict it to date selection by setting the Format property to either Short or Long. Main Page Copyright © 2008 C# Key Next