473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

DateTimePicker question

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
3 1254
"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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: E-Cube | last post by:
Hello All, I have a datetimepicker whose initial format is: DateTimePicker1.Format = DateTimePickerFormat.Custom DateTimePicker1.CustomFormat = " " DateTimePicker1.Checked = False which will...
9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
4
by: Jacek Jurkowski | last post by:
.... the minimum date of DateTimePicker is 1753-01-01. How to make DateTime to do not show nothing in its text if this date is the value? I have a form with a field LastLogonDate. If user hasn't...
2
by: Atley | last post by:
Is there a way to use the DateTimePicker to pick a time or is it just used to pick dates? If so, why is it called DATEtimepicker?
5
by: DC | last post by:
Hi All, Is there any way to find out which portion of a datetimepicker control in a windows form has been selected? Thanks. DC
7
by: Clamara | last post by:
When adding a new record from my form, I pre-set my DateTimePicker's value to System.DateTime.Today Since the "Today" value is used most of the time, the user doesn't need to select a date from...
3
by: Charlie | last post by:
In the top portion of the DateTimePicker, where the value of the date is displayed, how can I detect whether the month or day or year is currently focused, or, if ShowCheckBox = True, whether the...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
2
by: Todd Carnes | last post by:
I am trying to write an app in C# that requires the user to enter a date from 4000 B.C.E to 4000 C.E. I tried to use the DateTimePicker Control to allow the user to enter the date, but it only...
1
by: priyamtheone | last post by:
In C# 2005 how can i trap the checked/unchecked state of a datetimepicker through an event. I'm trying to execute two different methods based on the checked/unchecked state of a datetimepicker when...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.