views:

42

answers:

2

Hi all,

I am using DateTimePicker with Australian date formatting set (dd/mm/yyyy)

The problem is when user enters a day which is outside of the month (mm), control resets that day to "1".

This obviously is a quite confusing obstacle for user - it's not natural to enter the month first and then enter the day [culture-wise]

Is there a way to disable this validation or postpone it till say,when control loses focus?

Thanks!

+2  A: 

I've tried and I do not see anyway we can disable this for on micro-validation via the DateTimePicker's properties.

I know your frustration when the current date is "09/11/2009" (dd/MM/yyyy) and a user wants to enter "31/12/2009" via the keyboard from left to right.

DateTimePicker 1

Upon htting "31", it'll revert to "1" as Nov has only 30 days. It will show "2" if "32" is entered.

DateTimePicker2

It forces the user to enter the month first followed by the day. I.e. entering in the direction of right, left, far-right.

My suggestion is use a more generic form of format like yyyy-MM-dd which though does not follow your regional/cultural format, still is easily understood by the user (or Aussie friends).

o.k.w
A: 

Another option might be to instantiate an edit control and overlay it on top of the date time picker's edit, and use the value to set the date time picker's value. Of course, you'll need to do some validation before doing the setting; and you'll also want to mimic the way the date time picker's edit field allows you to select the date, month and year individually.

Shoko