DateTimePicker

smeeks

New member
Joined
Jun 24, 2004
Messages
1
Programming Experience
10+
When you click the down arrow on a DTP control, the ValueChanged event fires even if you don't pick a date in the drop down calender? I only want this event to fire if the user actually picks a different date than was previously in the DTP? Is there another event I should be using. Specifically, some of DTP's don't have an actual date assigned to them (loaded from a Database) when I create them...it's just set to the current date with the checkbox unchecked so the user knows it is not set. When the user picks the control I thought about comparing it(the value) to the actual date....and then I would know if they actually changed the date or not, but it is possible they could change it to a day other than today .....then back to today's date...which would cause this code to fail.

Since then I have found events fire when the user clicks the down arrow on the dtp.....once they actually pick a date from the calendar........I can't find an event that fires.


Thanks for any help
 
If a DTP is not checked and the calender is shown then the Value DOES change because a date is selected the moment the calender is displayed. Note that the check box becomes checked. That's the way the DTP works. I guess the assumption is that the user wouldn't want to see the calender if they didn't want to pick a date. Live with it and account for it in your event handlers.
 
Hmm dear Simple!
store the first selection in some class variable and then compare it with the current selection in Validating event (oh yeah dont forget to check the CuasesValidation property to True)
if the value does change then u can apply the change other wise simply ignore
 
Back
Top