DateTimePicker bug

0
0

in a form put a DateTimePicker and use this VBNET code:

Me.DateTimePicker1.Value = New Date(2021, 1, 1, 0, 0, 0, 0)
MessageBox.Show(“DateTimePicer value:” & DateTimePicker1.Value.ToString(“yyyy-MM-dd HH:mm:ss”) & ” is right”)
DateTimePicker1.Value = New DateTime(Now.Year, Now.Month, Now.Day, 23, 59, 59)
MessageBox.Show(“DateTimePicer value:” & DateTimePicker1.Value.ToString(“yyyy-MM-dd HH:mm:ss”) & ” is wrong”)
DateTimePicker1.Value = New DateTime(Now.Year, Now.Month, Now.Day, 23, 59, 59)
MessageBox.Show(“DateTimePicer value:” & DateTimePicker1.Value.ToString(“yyyy-MM-dd HH:mm:ss”) & ” is right”)

summarize:

if the starting date is different from today, the datetime picker fail to store the time the first time. If you put same datetime a second time, it work right.

best

Cristian

  • You must to post comments
0
0

Hi Kevin

I attach a project

best

  • You must to post comments
0
0

Hi Cristian,

I can’t reproduce the bug. When I set DateTimePicker1 with diferent value of today it get normally the Date. When I change DateTimePicker1 value it change correctly Control.

Can you send a sample project for more details ?

Best Kevin(ITG)

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.