This documentation is archived and is not being maintained.

DateTimePicker.ShowUpDown Property

Gets or sets a value indicating whether an up-down control is used to adjust the date/time value.

[Visual Basic]
Public Property ShowUpDown As Boolean
[C#]
public bool ShowUpDown {get; set;}
[C++]
public: __property bool get_ShowUpDown();
public: __property void set_ShowUpDown(bool);
[JScript]
public function get ShowUpDown() : Boolean;
public function set ShowUpDown(Boolean);

Property Value

true if an up-down control is used to adjust the date/time value; otherwise, false. The default is false.

Remarks

When ShowUpDown is set to true, an up-down control is used to adjust time values instead of the drop-down calendar. The date/time can be adjusted by selecting each element individually and using the up and down buttons to change the value.

Example

[Visual Basic, C#, C++] The following example creates an new instance of a DateTimePicker control and initializes it. The control's CustomFormat property is set. Also, the ShowCheckBox property is set so that the control displays a CheckBox, and the ShowUpDown property is set so that the control is displayed as an up-down control.

[Visual Basic] 
Public Sub CreateMyDateTimePicker()
    ' Create a new DateTimePicker control and initialize it.
    Dim dateTimePicker1 As New DateTimePicker()
    
    ' Set the MinDate and MaxDate.
    dateTimePicker1.MinDate = New DateTime(1985, 6, 20)
    dateTimePicker1.MaxDate = DateTime.Today
    
    ' Set the CustomFormat string.
    dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd"
    dateTimePicker1.Format = DateTimePickerFormat.Custom
    
    ' Show the CheckBox and display the control as an up-down control.
    dateTimePicker1.ShowCheckBox = True
    dateTimePicker1.ShowUpDown = True
End Sub 'CreateMyDateTimePicker

[C#] 
public void CreateMyDateTimePicker()
{
   // Create a new DateTimePicker control and initialize it.
   DateTimePicker dateTimePicker1 = new DateTimePicker();

   // Set the MinDate and MaxDate.
   dateTimePicker1.MinDate = new DateTime(1985, 6, 20);
   dateTimePicker1.MaxDate = DateTime.Today;

   // Set the CustomFormat string.
   dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
   dateTimePicker1.Format = DateTimePickerFormat.Custom;

   // Show the CheckBox and display the control as an up-down control.
   dateTimePicker1.ShowCheckBox = true;
   dateTimePicker1.ShowUpDown = true;
}
   

[C++] 
public:
void CreateMyDateTimePicker()
{
   // Create a new DateTimePicker control and initialize it.
   DateTimePicker* dateTimePicker1 = new DateTimePicker();

   // Set the MinDate and MaxDate.
   dateTimePicker1->MinDate = DateTime(1985, 6, 20);
   dateTimePicker1->MaxDate = DateTime::Today;

   // Set the CustomFormat string.
   dateTimePicker1->CustomFormat = S"MMMM dd, yyyy - dddd";
   dateTimePicker1->Format = DateTimePickerFormat::Custom;

   // Show the CheckBox and display the control as an up-down control.
   dateTimePicker1->ShowCheckBox = true;
   dateTimePicker1->ShowUpDown = true;
}
   

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

DateTimePicker Class | DateTimePicker Members | System.Windows.Forms Namespace | UpDownBase

Show: