473,769 Members | 6,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8195
On Mar 28, 1:20 pm, "Claes Wedin" <claes.we...@al tcom.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 = DateTimePickerF ormat.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
501
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 DateTimePicker1 (arrival date). can anyone help me on the code for this? as u can tell, im new learner. i also want the days between the arrival date and
9
3975
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 will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine when using the control on a win2k machine but if we use it on a win XP box and call
4
5684
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 logon yet this date should be empty but when binding a property to the DateTimePicker value it always shows value parsed prom property which is 1753-01-01. How to make an "empty" or "not set" date bindable to a value property of DateTimePicker?
7
6217
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 the DateTimePicker, since the default is shown. My problem is, if the user does not choose a value from the DateTimePicker (because using the default is good enough), then during database update, the date value is not saved to the database; while if...
7
2585
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 any solution that works without problems. Does anybody know where I can find an inherited DateTimePicker that supports databinding and nulll-values? Any links, sample code etc would be really appreciated! It can be for VB.NET 2005, in case that...
6
2558
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 with empty fields, their connected DateTimePicker's display the current date. Is there any way to have the DateTimePicker show as empty/blank? --- Kyote
0
2602
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 code I used as a starting point. Second, I hope this code helps someone as much as they helped me. I have built a Nullable DateTimePicker and NullableCalendarColumn/Cell/EditingControl that is nearly 100% complete, as far as I can tell. There is...
11
5020
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 is not sent to the DB and instead the default value of the text field which is 00-00-0000 is Sent so what i need is to make the value i picked replace the value of the Text Field and i cant seem to get the Js code which i downloaded . i'm...
0
5657
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 blank unless they are filled by the user. 2) As soon as the user enters a cell, the dtp control should appear as the editing control of that cell. If there's a value in the cell beforehand, that value is set as the value of the dtp editing control...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10222
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9999
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.