By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,206 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,206 IT Pros & Developers. It's quick & easy.

Date Picker

P: n/a
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?

Regards,
Rethish
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"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
Nov 20 '05 #2

P: n/a
Hello,

"Rethish" <r_*******@msn.com> schrieb:
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..


Set the 'ShowCheckBox' property to 'True'. If the checkbox is unchecked,
the control can be treated as empty.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3

P: n/a
Hi Jeremy,
When I am trying to set the date as empty for the DateTime picker, I got
the error like the date should be in between min and Max date of the date
picker.
How can I assign DateTimeControl.Value = New Date( ) for a date picker..?

Rethish

"Jeremy Cowles" <jeremy.cowles[nosp@m]asifl.com> wrote in message
news:nw*********************@twister.tampabay.rr.c om...
"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

Nov 20 '05 #4

P: n/a
"Rethish" <r_*******@msn.com> schrieb
Hi Jeremy,
When I am trying to set the date as empty for the DateTime
picker, I got
the error like the date should be in between min and Max date of the
date picker.
How can I assign DateTimeControl.Value = New Date( ) for a date
picker..?


I haven't used the DateTimePicker yet, and maybe the question is better for

microsoft.public.dotnet.framework.windowsforms.con trols

(because it is not VB.NET specific) but I'd say that the statement
concerning min/max dates should be followed. Whenever you create a new Date,
the default value is the 1st of january in the year 0001. That's probably
not in the range from DateTimePicker.MinDate to DateTimePicker.MaxDate.
--
Armin

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.