Skip to main content
Email Password   helpLost your password?

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.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralUpdate Pin
Romain TAILLANDIER
23:37 21 Sep '09  
GeneralThis is a very insightful approach to the problem Pin
Phil Raevsky
17:01 28 Aug '09  
GeneralThis one dispaly pink if null date (VB.NET) Pin
Larry Rouse
12:32 28 Aug '09  
GeneralThis one works! (VB 2008) [modified] Pin
Jeromeyers
13:55 10 Feb '09  
GeneralRe: This one works! (VB 2008) Pin
EMYNA
13:40 28 Oct '09  
GeneralUse the Nullable Datetime for a more updated solution. Pin
chstngs
6:39 7 Oct '08  
GeneralIt's really great! Thank you very much!! Pin
wxpwu
3:48 15 Jun '08  
GeneralSmall correction Pin
Maxxx333
2:32 16 Nov '06  
GeneralRe: Small correction - an enhancement to that correction Pin
ccbt
20:27 9 Sep '09  
GeneralNull Button? Pin
Kysonel
10:48 28 Mar '06  
GeneralHow to use? Pin
strent00
6:54 21 Dec '05  
GeneralCool! Pin
Super Lloyd
17:36 19 Dec '05  
GeneralClicking on current date in dropdown doesn't show datetime Pin
jfk80@wp.pl
3:38 15 Mar '05  
Generalbind data to date time picker Pin
ccloon
23:11 20 Feb '05  
GeneralRe: bind data to date time picker Pin
Claudio Grazioli
11:36 28 Mar '05  
GeneralRe: bind data to date time picker Pin
Claudio Grazioli
23:45 24 May '05  
AnswerRe: bind data to date time picker Pin
alc_aardvark
7:07 14 May '08  
GeneralRe: bind data to date time picker Pin
Roonda
20:13 6 Apr '09  
GeneralDisplay blank space when NULL Pin
SupaHoopsa
5:56 9 Feb '05  
GeneralRe: Display blank space when NULL Pin
Claudio Grazioli
23:16 19 Apr '05  
GeneralThank you Pin
janine_olley
5:37 12 Oct '04  
General"Error creating window handle error" on TabControl control Pin
SMiLEZ
9:11 28 Sep '04  
GeneralRe: "Error creating window handle error" on TabControl control Pin
Brett Zimmerman
17:00 5 Oct '04  
GeneralRe: "Error creating window handle error" on TabControl control Pin
Claudio Grazioli
22:02 18 Apr '05  
GeneralThanks Pin
Tom Fischer
5:30 18 Jun '04  


Last Updated 17 Nov 2003 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009