Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

DateTimePicker.ShowCheckBox Property

Gets or sets a value indicating whether a check box is displayed to the left of the selected date.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public bool ShowCheckBox { get; set; }
/** @property */
public boolean get_ShowCheckBox ()

/** @property */
public void set_ShowCheckBox (boolean value)

public function get ShowCheckBox () : boolean

public function set ShowCheckBox (value : boolean)

Property Value

true if a check box is displayed to the left of the selected date; otherwise, false. The default is false.

When the ShowCheckBox property is set to true, a check box is displayed to the left of the date in the control. When the check box is selected, the date/time value can be updated. When the check box is cleared, the date/time value is unable to be changed.

The following code 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 a spin button control (also known as an up-down control).

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;
}
   

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

    // Set the MinDate and MaxDate.
    dateTimePicker1.set_MinDate(new DateTime(1985, 6, 20));
    dateTimePicker1.set_MaxDate(DateTime.get_Today());

    // Set the CustomFormat string.
    dateTimePicker1.set_CustomFormat("MMMM dd, yyyy - dddd");
    dateTimePicker1.set_Format(DateTimePickerFormat.Custom);

    // Show the CheckBox and display the control as an up-down control.
    dateTimePicker1.set_ShowCheckBox(true);
    dateTimePicker1.set_ShowUpDown(true);
} //CreateMyDateTimePicker

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.