Descubrí cuál era el problema aquí.
La propiedad Value
solo establece un nuevo valor si el control DateTimePicker
está visible. De lo contrario, el comando se ignora.
caso de prueba:
no funciona:
this.picker = new DateTimePicker
{
Checked = false,
Font = new System.Drawing.Font("Verdana", 9.75F),
Format = System.Windows.Forms.DateTimePickerFormat.Time,
Location = new System.Drawing.Point(5, 5),
Name = "picker",
ShowUpDown = true,
Size = new System.Drawing.Size(120, 23),
Visible = false
};
this.Controls.Add(this.picker);
this.picker.Value = this.picker.Value.Date.AddHours(1);
this.picker.Visible = true;
Obras:
this.picker = new DateTimePicker
{
Checked = false,
Font = new System.Drawing.Font("Verdana", 9.75F),
Format = System.Windows.Forms.DateTimePickerFormat.Time,
Location = new System.Drawing.Point(5, 5),
Name = "picker",
ShowUpDown = true,
Size = new System.Drawing.Size(120, 23),
Visible = false
};
this.Controls.Add(this.picker);
this.picker.Visible = true;
this.picker.Value = this.picker.Value.Date.AddHours(1);
no parece tener nada que ver con la adición programáticamente el selector de lo que parece.
+1 porque creo que tengo un problema similar. – reverendlarry