The .NET Compact Framework version 2.0 supports the DateTimePicker class, but with only the following members:
- CalendarFont property. 
- CustomFormat property. 
- Format property. The .NET Compact Framework supports all values of the DateTimePickerFormat enumeration. 
- MaxDate property. 
- MinDate property. 
- ShowUpDown property. 
- ValueChanged event. 
- OnValueChanged method. 
Note that because OnValueChanged is provided, a derived class can use this method without having to connect an event handler delegate. For more information about using delegates, see Raising an Event.
| .gif) Note | 
|---|
| The DateTimePicker for the Smartphone will be available in Windows Mobile version 5.0 software for Smartphone. Note that the control on the Smartphone does not have the up-down selector because values are selected with the navigation keys. | 
Example
The following code example shows how you can configure a DateTimePicker control in the .NET Compact Framework.
Private Sub SetupDateTimePicker()
   ' Set the MinDate and MaxDate.
   DateTimePicker1.MinDate = new DateTime(1985, 6, 12)
   DateTimePicker1.MaxDate = DateTime.Today
   'Set the format.
   DateTimePicker1.Format = DateTimePickerFormat.Short
   ' Define a custom format.
   DateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd"
   ' If you want to use the custom format, change
   ' DateTimePickerFormat.Short to DateTimePickerFormat.Custom.
   ' Display the control with the up-down selector.
    DateTimePicker1.ShowUpDown = True
End Sub
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
    ' Respond to changes, such as using  
    ' the updated value in your application.
End Sub
private void SetupDateTimePicker()
{
   // Set the MinDate and MaxDate.
   dateTimePicker1.MinDate = new DateTime(1985, 6, 12);
   dateTimePicker1.MaxDate = DateTime.Today;
   // Set the format.
   dateTimePicker1.Format = DateTimePickerFormat.Short;
   // Define a custom format.
   dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
   // If you want to use the custom format, change
   // DateTimePickerFormat.Short to DateTimePickerFormat.Custom.
   // Display the control with the up-down selector.
   dateTimePicker1.ShowUpDown = true;
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
 // Respond to changes, such as using
 // the updated value in your application.
}
Compiling the Code
This example requires references to the following namespaces:
See Also
Other Resources
Windows Forms Controls in the .NET Compact Framework
Graphics and Drawing