472,365 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to get a DateTimePicker accept and show empty date (emty string/space/null)?

My customer needs a DateTimePicker in VS2005 C# that can show emty date
values (blank/space/null).

I need a control that:

1. Can show a blank value
2. Detete a date when hitting the delete and/or back key
3. Allowse the user to enter yyyy-MM-dd date format manually
4. When tabbed into the field behaves juast like a textbox

and of course dropdown the datepict -calender...
I cannot getthe standard control to do this so I searched on the net.
I have tried several of the solutions that I found bun none worked OK.
The best (TAS DateTimePicker:
http://www.codeproject.com/cs/miscct...&forumid=14186)
works exactly like I want, but it is not VS2005. So I migrate it and get no
errors, build it with errors but when I drag it to the form I get an errror
that the string is not in correct date format...

Anybody have a solution of any kind???

TIA

Claes
Mar 28 '07 #1
2 8076
On Mar 28, 1:20 pm, "Claes Wedin" <claes.we...@altcom.sewrote:
My customer needs a DateTimePicker in VS2005 C# that can show emty date
values (blank/space/null).

I need a control that:

1. Can show a blank value
2. Detete a date when hitting the delete and/or back key
3. Allowse the user to enter yyyy-MM-dd date format manually
4. When tabbed into the field behaves juast like a textbox

and of course dropdown the datepict -calender...
I cannot getthe standard control to do this so I searched on the net.
I have tried several of the solutions that I found bun none worked OK.
The best (TAS DateTimePicker:http://www.codeproject.com/cs/miscct...epicker.asp?df...)
works exactly like I want, but it is not VS2005. So I migrate it and get no
errors, build it with errors but when I drag it to the form I get an errror
that the string is not in correct date format...

Anybody have a solution of any kind???

TIA

Claes
You can make the DateTimePicker show a blank on the control using this
code:

dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "''";

Notice that the Custom format is a string of 2 apostrophes.

Note also that this does not change the date VALUE of the
DateTimePicker, only the display.

Chris

Mar 29 '07 #2
Thanks, a good idea but it does not help because we need to:

1. Make the value nullable...
2. Allow the user to enter the date manually (or use the calender)

but I think I know how to do this:

Place a textbox in front of the datetimepicker, hiding the datefield but not
the drop-arrow If the user uses the calendar just place the date in the
textbox and if the user enters it manually, just validateit...
Apr 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Angelina | last post by:
Hi, I have got two DateTimePicker's on my form to accept a guest arrival date and departure date.what i want to acheieve is ensure that the DateTimePicker2 (departure) is always greater than...
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...
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...
7
by: Pieter | last post by:
Hi, I'm looking for a DateTimePicker that supports 100% databinding (and support null-values)... It's a shame that the normal control doesn't, but when searching on the internet, I didn't find...
6
by: Kyote | last post by:
I'm using a DateTimePicker for date fields in an Access db Membership app. Some of the date fields are empty, meaning they haven't been filled out yet, or they cannot be. But when a record is read...
0
by: tschroeder250 | last post by:
Hi Everyone, There are so many Nullable DateTimePickers out there that this post may not even be found among all the others, but I wanted to try. First, I want to thank all the authors of the...
11
by: jessy | last post by:
Hi, I have a problem with my DateTimePicker javascript code which i downloaded , the problem is when i pick the date and the date appears in my Text Field and i click Submit the date which i picked...
0
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.