I found out what the problem is.
The Value property sets only the new value if the DateTimePicker control is displayed. Otherwise, the command is ignored.
Test case:
Does not work:
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;
Working:
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);
It seems to have nothing to do with the software add-in collector.
Goneale
source share