Click here to Skip to main content
12,819,950 members (29,177 online)
Click here to Skip to main content
Add your own
alternative version

Stats

617K views
14.5K downloads
53 bookmarked
Posted 11 Nov 2003

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

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

You may also be interested in...

Comments and Discussions

 
PraiseSimple is beautiful! Pin
ineedajobsoon4-Mar-16 3:54
memberineedajobsoon4-Mar-16 3:54 
QuestionNullable DateTimePicker Pin
Member 1174358825-Jun-15 21:47
memberMember 1174358825-Jun-15 21:47 
QuestionKhông sử dụng được Custom Format Pin
Do Cao Tri13-Dec-14 6:25
memberDo Cao Tri13-Dec-14 6:25 
QuestionNot work anymore ? Pin
duonglei16-Jun-14 23:20
memberduonglei16-Jun-14 23:20 
QuestionData Binding Pin
wiggles30-May-14 6:50
memberwiggles30-May-14 6:50 
QuestionProblem with this control Pin
MarkRyan19812-Jan-14 0:53
memberMarkRyan19812-Jan-14 0:53 
QuestionNot able to download the Source Files Pin
hdng7631-Oct-12 6:00
memberhdng7631-Oct-12 6:00 
QuestionHow easy is that!! Pin
Woody10022-Sep-12 1:30
memberWoody10022-Sep-12 1:30 
QuestionJust what I needed Pin
gemini_dk20-Dec-11 5:43
membergemini_dk20-Dec-11 5:43 
AnswerRe: Just what I needed Pin
jf6425-Jan-12 5:57
memberjf6425-Jan-12 5:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170308.1 | Last Updated 18 Nov 2003
Article Copyright 2003 by Pham Minh Tri
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid