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

DateTimePicker question

P: n/a
M K
Can you initialize the DateTimePicker to "" or Null? I want the date to be
optional so it should be blank at first unless the user selects a date. If
not, is there another solution?

Mark
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"M K" <sk*******@yahoo.com> wrote in
news:Py*******************@twister.southeast.rr.co m:
Can you initialize the DateTimePicker to "" or Null? I want the date
to be optional so it should be blank at first unless the user selects
a date. If not, is there another solution?

Mark


One way to clear the text is to use blank custom format:

DateTimePicker1.Format = DateTimePickerFormat.Custom
DateTimePicker1.CustomFormat = " " ' need a space

then once you want it to be displayed again reset it to
whatever format you want:

DateTimePicker1.Format = DateTimePickerFormat.Short

It will still have a value when there is no text.
Nov 21 '05 #2

P: n/a
"M K" <sk*******@yahoo.com> schrieb:
Can you initialize the DateTimePicker to "" or Null? I want the date to
be optional so it should be blank at first unless the user selects a date.
If not, is there another solution?

You can use the datetimepicker's checkbox (see properties 'ShowCheckBox' and
'Checked') to indicate null values or valid selections. Alternatively take
a look at the solutions shown at
<URL:http://groups.google.de/group/microsoft.public.dotnet.framework.windowsforms/msg/98967faca85a6172>.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
M K
thanks hoppy that did the trick.. i had part of it but didnt set it to
custom.. thanks
"M K" <sk*******@yahoo.com> wrote in message
news:Py*******************@twister.southeast.rr.co m...
Can you initialize the DateTimePicker to "" or Null? I want the date to
be optional so it should be blank at first unless the user selects a date.
If not, is there another solution?

Mark

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.