Click here to Skip to main content
Click here to Skip to main content
Go to top

Nullable DateTimePicker

, 17 Nov 2003
Rate this:
Please Sign up or sign in to vote.
A standard DateTimePicker control that enables users to enter null value. The fact that it's not intensively modified ensures that it has no potential errors.

Sample Image - Nullable_DateTimePicker.jpg

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 Smile | :) .

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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Pham Minh Tri

Vietnam Vietnam
No Biography provided

Comments and Discussions

 
QuestionNot work anymore ? Pinmemberduonglei16-Jun-14 22:20 
QuestionData Binding Pinmemberwiggles30-May-14 5:50 
QuestionProblem with this control PinmemberMarkRyan19811-Jan-14 23:53 
QuestionNot able to download the Source Files [modified] Pinmemberhdng7631-Oct-12 5:00 
QuestionHow easy is that!! PinmemberWoody10022-Sep-12 0:30 
QuestionJust what I needed Pinmembergemini_dk20-Dec-11 4:43 
AnswerRe: Just what I needed Pinmemberjf6425-Jan-12 4:57 
GeneralNo hour in sql database Pinmembercyrilcp9-Nov-10 0:16 
GeneralValidation wrong value fix PinmemberPREMSONBABY20-May-10 4:38 
GeneralRe: Validation wrong value fix Pinmemberoliwan30-Sep-10 12:16 
GeneralRe: Validation wrong value fix PinmemberDeuceDude28-Oct-11 15:46 
Generalthank you for your help! Pinmemberwuhai08095-May-10 14:52 
GeneralSet Nullable DateTimePicker default value [00/00/0000] Pinmembertinhleduc26-Feb-10 0:27 
GeneralUpdate PinmemberRomain TAILLANDIER21-Sep-09 22:37 
GeneralThis is a very insightful approach to the problem PinmemberPhil Raevsky28-Aug-09 16:01 
GeneralThis one dispaly pink if null date (VB.NET) PinmemberLarry Rouse28-Aug-09 11:32 
GeneralThis one works! (VB 2008) [modified] PinmemberJeromeyers10-Feb-09 12:55 
GeneralRe: This one works! (VB 2008) PinmemberEMYNA28-Oct-09 12:40 
GeneralRe: This one works! (VB 2008) [modified] PinmemberChris Wineinger13-Feb-13 8:31 
GeneralUse the Nullable Datetime for a more updated solution. Pinmemberchstngs7-Oct-08 5:39 
GeneralIt's really great! Thank you very much!! Pinmemberwxpwu15-Jun-08 2:48 
GeneralSmall correction PinmemberMaxxx33316-Nov-06 1:32 
GeneralRe: Small correction - an enhancement to that correction Pinmemberccbt9-Sep-09 19:27 
GeneralRe: Small correction - an enhancement to that correction BugFixing =) [modified] PinmemberLeonunicorn4-Dec-09 1:45 
GeneralRe: Small correction - an enhancement to that correction BugFixing x 2 [modified] Pinmemberkipotlov11-Dec-09 6:14 
GeneralRe: Small correction - an enhancement to that correction BugFixing x 2 PinmemberLeonunicorn15-Dec-09 4:57 
GeneralRe: Small correction - an enhancement to that correction BugFixing x 2 PinmemberLeonunicorn4-Jan-10 3:42 
QuestionNull Button? PinmemberKysonel28-Mar-06 9:48 
QuestionHow to use? Pinmemberstrent0021-Dec-05 5:54 
GeneralCool! PinmemberSuper Lloyd19-Dec-05 16:36 
GeneralClicking on current date in dropdown doesn't show datetime Pinmemberjfk80@wp.pl15-Mar-05 2:38 
Generalbind data to date time picker Pinmemberccloon20-Feb-05 22:11 
GeneralRe: bind data to date time picker PinmemberClaudio Grazioli28-Mar-05 10:36 
GeneralRe: bind data to date time picker PinmemberClaudio Grazioli24-May-05 22:45 
AnswerRe: bind data to date time picker Pinmemberalc_aardvark14-May-08 6:07 
GeneralRe: bind data to date time picker PinmemberRoonda6-Apr-09 19:13 
GeneralDisplay blank space when NULL PinmemberSupaHoopsa9-Feb-05 4:56 
GeneralRe: Display blank space when NULL PinmemberClaudio Grazioli19-Apr-05 22:16 
GeneralThank you Pinmemberjanine_olley12-Oct-04 4:37 
General"Error creating window handle error" on TabControl control PinmemberSMiLEZ28-Sep-04 8:11 
GeneralRe: "Error creating window handle error" on TabControl control PinmemberBrett Zimmerman5-Oct-04 16:00 
GeneralRe: "Error creating window handle error" on TabControl control PinmemberClaudio Grazioli18-Apr-05 21:02 
GeneralThanks PinmemberTom Fischer18-Jun-04 4:30 
GeneralCould you have vb.net version PinmemberTony Dong25-May-04 11:10