I'm using VS2008 and have an unbound DateTimePicker control on a windows form.
It's working correctly if I select a date from the calendar and then press tab to exit.
I have a "Validated" event and the Text property (and value property) show the value as displayed.
However, If I go back and manually change the day from the 5th to the 6th for example and then tab out of the control the new value is not always being picked up in the "Validated" event.
Sometimes it is correct, sometimes not, more than half the time not!
I have put breakpoints in at other points (i.e. on entering another field) and it appears to be correct then.
It's almost as if there is a delay in recognising the change.
I've even resorted to adding an Application.DoEvents() in the validated event prior to checking the value but that has not helped.
Please note that the problem ONLY happens when manually changing the date (not from the calendar) and TABBING off the control. If I manually change the value and then use the mouse to navigate to another field it always works correctly.
I really can't beleive I'm having such hassle from a simple thing, I've spent hours trying to find a cause or a particular pattern without success.
I would be grateful for any help in this matter.
It's working correctly if I select a date from the calendar and then press tab to exit.
I have a "Validated" event and the Text property (and value property) show the value as displayed.
However, If I go back and manually change the day from the 5th to the 6th for example and then tab out of the control the new value is not always being picked up in the "Validated" event.
Sometimes it is correct, sometimes not, more than half the time not!
I have put breakpoints in at other points (i.e. on entering another field) and it appears to be correct then.
It's almost as if there is a delay in recognising the change.
I've even resorted to adding an Application.DoEvents() in the validated event prior to checking the value but that has not helped.
Please note that the problem ONLY happens when manually changing the date (not from the calendar) and TABBING off the control. If I manually change the value and then use the mouse to navigate to another field it always works correctly.
I really can't beleive I'm having such hassle from a simple thing, I've spent hours trying to find a cause or a particular pattern without success.
I would be grateful for any help in this matter.