0

How to show actual Time with DateTimePicker - WinForms [SOLVED]

hi there, i'm trying to show the actual time, but my datetimepicker1 isnt updating itself. i've tried refresh() and i included a timer with an interval of 100ms - firing an event to set the value to datetimepicker1.value = datetime.now ... nothing works, any ideas? // dateTimePicker1 // this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Time; this.dateTimePicker1.Location = new System.Drawing.Point(472, 420); this.dateTimePicker1.Name = "dateTimePicker1"; this.dateTimePicker1.Size = new System.Drawing.Size(305, 26); this.dateTimePicker1.TabIndex = 3; // // timer1 // this.timer1.Interval = 100; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); ############################# private void timer1_Tick(object sender, EventArgs e) { dateTimePicker1.Value = DateTime.Now; }

11th Jun 2019, 5:03 PM
Oliver
2 Antworten
+ 2
Oliver Hemker To notify others that the case has been solved, please mark the question solved by adding [SOLVED] prefix to the question title : ) Well done! 👍
11th Jun 2019, 5:39 PM
Ipang
+ 1
Solved. timer1.Enabled = true; did the job.
11th Jun 2019, 5:16 PM
Oliver