"Rethish" <r_*******@msn.com> wrote in message
news:un**************@TK2MSFTNGP11.phx.gbl...
Hi All,
I am developing an application in VB.net. I am using .Net Datetime
picker control to manage the date. But I am not able to assign null/Empty
value to the control. I found the property "Checked" to work with this
control..But I cannot use this property for making null dates..
Is there any way to solve this problem?.
Expecting any help or suggestions?
What is a "Null" date? ... 1932 1:30 am, 2003 2:39 pm? What is a "Null"
Integer? The point is that DateTime (and Date) is a structure in .NET, not a
Class. This means that there is no true "Null" or Nothing state for the
object, there is only an initial state: 1/1/1900 12:00 AM. So if the object
is = the initial state, then it is empty. You can get around this by
setting the date = New Date( ) or by using the Checked property.
'// Check for a "null" or empty date:
If DateTimeControl.Value.Equals(New Date()) Then
'// the date is empty/null/nothing
End If
'// Set a null/empty date:
DateTimeControl.Value = New Date( )
HTH
~
Jeremy