|
-
Dec 19th, 2003, 07:27 PM
#1
Thread Starter
Addicted Member
DateTimePicker??
Using a date time picker, I’m getting a can not contain null value error when clicking the Save button.
How can I fix that.
Thanks!
-
Dec 19th, 2003, 07:48 PM
#2
Sleep mode
-
Dec 19th, 2003, 07:57 PM
#3
Thread Starter
Addicted Member
There is no code I did not think that it needed code! cause the box already has text in it. "So I thought"
If I was to try it rite now without touching the DataTimePicker it would Error out, but if I was to just pull the picker down and click on 19 it would work fine ??? It just errors if the Date is not clicked.
Thanks!
-
Dec 19th, 2003, 08:16 PM
#4
Sleep mode
I don't know what's this problem . I tried to generate any error but it's all working . Are you using any cutome formats ?
-
Dec 19th, 2003, 08:39 PM
#5
Thread Starter
Addicted Member
MM/DD/YY
That’s about it.
I have two Forms and it does the same thing on both
If it is seeing it as Null Value if not clicked, is there a way to code a date into it so that when using current date it don't have to be clicked?
-
Dec 19th, 2003, 11:09 PM
#6
I wonder how many charact
Where'd you get this Date/Time Picker?
-
Dec 20th, 2003, 12:34 AM
#7
Thread Starter
Addicted Member
OK! I apologize if I did not make myself clear enough.
It is the DateTimePicker out of the Toolbox, it is a Data member in my DataSet
Something screwy is been happening. At first I was using just a text box witch kept on putting 12:00am behind my date, that is why I decided to go with the DateTimePicker.
All is well, unless I forget to Make a selection then I get the Null Value Error.
I was under the Impression that the DateTimePicker automatically displays today’s date and that it would be sufficient to make a Data entry.
I don’t Care witch one I use but they have both given me problems.
One adds 12:00am and the other don’t auto select the date.
???????
Last edited by Rally2000; Dec 20th, 2003 at 12:48 AM.
-
Dec 20th, 2003, 04:06 AM
#8
Hyperactive Member
Your have to give it an initial value,weuse them and in the load event of the form always pust something like:
DateTimePicker1.Value = Now
unless of course you are binding it to exitisng data.
-
Dec 20th, 2003, 04:06 AM
#9
Hyperactive Member
Your have to give it an initial value,weuse them and in the load event of the form always pust something like:
DateTimePicker1.Value = Now
unless of course you are binding it to exitisng data.
-
Dec 20th, 2003, 07:32 AM
#10
Sleep mode
I don't know really what's wrong and had no problems with this control before . You don't even need to set any value . Just paste it on your form and it should , get today's date , no need for any code .
-
Dec 20th, 2003, 09:06 AM
#11
I wonder how many charact
In my forays into date/time picking... I noticed the need for this:
1) If the user doesn't explicitly enter a value, the database should represent this as Null, not today's date.
2) The control in the VS toolbox sets itself to today's date/time by default when it loads, effectively demolishing the logic rule set in #1.
3) I always got around this by making a custom control that simply returns nothing in its DateTimeValue property if it was never set by the user, thereby effectively enforcing the first statement.
-
Dec 21st, 2003, 07:06 PM
#12
Thread Starter
Addicted Member
My DateTimePicker is bound to a database, and I have already found it to be a problem. It simply gets forgotten because the existing Date.
Is there any way to fix this?
-
Dec 22nd, 2003, 04:36 AM
#13
Thread Starter
Addicted Member
Anyone?
-
Dec 22nd, 2003, 09:04 AM
#14
Frenzied Member
what's the control for exactly? Couldn't you just use a date funtion and paste the info on a label? Or is this a control for databases or something?
-
Dec 22nd, 2003, 09:29 AM
#15
Hyperactive Member
I think your problem is that you are trying to bind a null value date to the control. Cannot think of anything else as have never experienced the sorts of problems you describe with this control.
Why not remove the binding and handle it through as Edit. Not a solution but I am at a loss as to understand why you are having the problems you do.
If necessary you can always add a handler and use that instead of binding directly and in the handler code determines what to do if to if you try to parse a null value date.
Perhaps post some code. I don't know and feel have nothing more I can contribute to this thread
-
Dec 22nd, 2003, 12:33 PM
#16
Sleep mode
Data binding is hell . If you want to cut off this problem , create a property or variable that set/get the value from DTP control using DTP.Value method . It's much more safer to the user of your program .
-
Dec 22nd, 2003, 02:37 PM
#17
Thread Starter
Addicted Member
I was thinking that, but also hoping for an easy fix.
Thanks!
-
Dec 22nd, 2003, 03:24 PM
#18
Sleep mode
Do it this way to have more control on your code . I know it's a bit longer but the output is readable and maintainable code .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|