Introduction
I had do a research on a DateTimePicker
that could enter null value and found a lot of solutions to it. But one major problem with those is that they behave quite different from the standard ones and may have many potential bugs, as a result it took time to test before using in a real application. I just found another simple solution that could solve this problem with a little modification, so it could promise no bugs :-).
Solution
I have overridden the Value
property to accept Null
value as DateTime.MinValue
, while maintaining the validation of MinValue
and MaxValue
of the standard control. That's all there's to it.
Because it's so simple, there's not much to say about it. Please refer to code for details.