DateTimePicker Question

Bernie

Well-known member
Joined
Aug 13, 2007
Messages
98
Programming Experience
3-5
I have a form that collects user parameters to print a report. There are two DateTimePickers to let the user select a date range for the report. The selection of a date range is optional so I set the From picker to a date before any data could be present.

If the user wants to select a date range, the from field is set to a very old date so it takes a long time to get to any current dates. Whe I'd like to do is when the user drops down the picker, reset the date to today and let the user scroll from there.

I tried the dropdown even in the picker, but the new date doesn't get set until the user has already selected a date.

Any suggestions on how to get this type of UI behavior? Also any better suggestions to streamline the process?

The main objective it to collect from and to dates from the user is they want to select them and collect wide ranging dates if the user doesn't enter any.

Thanks,
Bernie
 
Use a checkbox with a caption of "Filter between dates", and monitor the click event. When the checkbox is changed to Checked, set your default dates and then enable the DateTimePickers. When it is changed to Unchecked, reset the dates to your defaults and disable the DTPs.
 
Agreed, or use NullableDateTimePicker

Also, DateTimePickers can have a checkbox of their own, within the date box. It's pretty ugly though
 
Back
Top