Share via


DateTimePicker.ShowUpDown Propiedad

Definición

Obtiene o establece un valor que indica si se utiliza un control de botón de número (también conocido como control de flechas) para ajustar el valor de fecha y hora.

public:
 property bool ShowUpDown { bool get(); void set(bool value); };
public bool ShowUpDown { get; set; }
member this.ShowUpDown : bool with get, set
Public Property ShowUpDown As Boolean

Valor de propiedad

Boolean

Es true si se utiliza un control de botón de número para ajustar el valor de fecha y hora; en caso contrario, es false. De manera predeterminada, es false.

Ejemplos

En el ejemplo de código siguiente se crea una nueva instancia de un DateTimePicker control y se inicializa. Se establece la propiedad del CustomFormat control. Además, la ShowCheckBox propiedad se establece para que el control muestre un CheckBoxy la ShowUpDown propiedad se establezca para que el control se muestre como un control de botón de número.

public:
   void CreateMyDateTimePicker()
   {
      // Create a new DateTimePicker control and initialize it.
      DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker;
      
      // Set the MinDate and MaxDate.
      dateTimePicker1->MinDate = 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.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 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

Comentarios

Cuando la ShowUpDown propiedad se establece trueen , se usa un control de botón de número (también conocido como control de arriba a abajo), en lugar de un calendario desplegable, para ajustar los valores de tiempo. La fecha y hora se pueden ajustar seleccionando cada elemento individualmente y usando los botones arriba y abajo para cambiar el valor.

Para mostrar solo la hora en , DateTimePickerestablezca la Format propiedad Timeen y la ShowUpDown propiedad en true.

Se aplica a

Consulte también