risxie

risxie

  • NA
  • 1
  • 0

DateTimePicker .Value and .Text properties do not match

Feb 4 2006 11:20 PM
Hi guys,

I have an urgent, weird bug with DateTimePicker, and it's not 100% replicable.

What happened is that we have a screen that allows user to select a date in the DateTimePicker (dd/MM/yyyy, no check box) through the following means:
1. Type it in
2. Click down arrow to display calendar and click a future date
3. Click down arrow to display calendar and click the 'next month >' arrow, then click away from the DateTimePicker area (say to another text box). Basically this is the easy way to denote the date 1 month later.

Now in the DateTimePicker_Leave() event handler, we have display a Modal dialog box with the selected date shown.

However, at certain weird times, what is shown in the
GUI DateTimePicker is different from what is shown on the dialog box. E.g. user inputs 04/03/2006, and the DateTimePicker displays: 04/03/2006, but Dialog box displays: 04/02/2006.

Looking further into the code, I added a watch point for
debugging, and discovered that:
DateTimePicker.Value = 04/02/2006
DateTimePicker.Text = 04/03/2006

It is a very weird bug and I've not been able to pinpoint why the .Value and .Text may be different at times. Has any of you guys experience the same problem with DateTimePicker in VS.NET 2002 AND 2003? Any help will be hugely appreciated.