.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 24th, 2003, 02:13 PM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
Unhappy Converting a DateTimePicker value in null ?

I am coding in Vb.Net
I knew it was possible (or I am pretty sure it was) in vb.6 to use the null in a datetimepicker.

I need to have 2 dateTimePicker cause at first it was only textbox that were validated, but I got a request from some users that they wanted to see a Calender at this place.

I have one that is the Date I received the documents and the other one is the date the document has been send back.

for the first one, I don't have problem, there is always a value in it, today or another one.

but for the second one. if the documents haven't been send back yet, the value need to be Nothing, it's need to be empty. but I haven't found any way to do it.

when I do, DateTimePicker1.Value = System.DBNull.Value
it's just tell me that a DbNull.Value can't be converted to a date value.

What's should I do then ?
my boss told me that January 1 of 1900 is a null value but that's not true, I haven,t found anything about it. and that way it will be complicate for the user to delete de date, he won't remeber to change it for january 1, 1900


Any one got any idea on how I could go and get all of this out and running ?
__________________

Reply With Quote
  #2  
Old November 25th, 2003, 06:55 PM
iamtgo3 iamtgo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: USA
Posts: 313 iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level)iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level)iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level)iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level)iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 h 31 m 33 sec
Reputation Power: 17
Are you putting this in a database and have to make the field NULL.

PHP Code:
Private Sub btnClear1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles btnClear1.Click
        
'This Clears the Media Date and sets it to DBNULL
        '
MessageBox.Show(Me.dsMediaInfo.Tables("MediaInfo").Rows(0).Item(4))

        
Me.dsPhotoInfo.Tables("PhotoInfo").Rows(0).Item(3) = System.DBNull.Value

    End Sub 

Reply With Quote
  #3  
Old November 26th, 2003, 08:37 AM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
No, what I wanted to do is the inverse. I want the datetimepicker to be at null if it's need to.

It's read the information from the database and add the date to the datetimepicker but sometimes the date in the database is null, soo I need to add a Null Value to the datetimepicker.

and the user also need to have the possibility to choose a null value for the date to record it in the database.

Reply With Quote
  #4  
Old November 26th, 2003, 10:31 AM
iamtgo3 iamtgo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: USA
Posts: 313 iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level)iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level)iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level)iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level)iamtgo3 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 h 31 m 33 sec
Reputation Power: 17
what you could do is this have a default value if it is null. Like January 1 of 1900 so when you save the record back to the database use the datepicker validation if equal to January 1 of 1900 then set the value for that field in the database to System.DBNull.Value. I have had similiar issues with the datepicker control. It is great to use but has some issue that is to bad.

Reply With Quote
  #5  
Old December 2nd, 2003, 04:07 PM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
Quote:
Originally posted by iamtgo3
what you could do is this have a default value if it is null. Like January 1 of 1900 so when you save the record back to the database use the datepicker validation if equal to January 1 of 1900 then set the value for that field in the database to System.DBNull.Value. I have had similiar issues with the datepicker control. It is great to use but has some issue that is to bad.


yeah that's the samething I was thinking of doing. But it could complicate some people. You would need to go choose that date everytime the user want a date :S ! that's bad imo.

also, because the users check the textbox and if it's empty it,s mean that the document haven't been sent, if there is a value, that's mean it's haven been sent. soo with a date in a datapicker with will be more complicate may be for them

I don't know what to do lol

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Converting a DateTimePicker value in null ?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap