Home All Groups Group Topic Archive Search About

Databinding DateTimePicker and zeroing results?

Author
5 May 2007 4:47 PM
Kyote
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

Author
5 May 2007 7:30 PM
Michel Posseth [MCP]
You might investigate my date entry control

wich can handle db nulls and show a empty box and lots and loots more (
investigate the property`s of the control )

http://www.vbdotnetcoder.com/Downloads/Examples/AuthorMP/dateentry.zip

i wrote this control for the company i work for , for simple date entry
while still providing data binding ( the controls takes any entry that is
valid for cdate  , 1-1 , 1 jan etc etc etc )
it comes with a sample project and full sourcecode.

regards

Michel Posseth





Show quoteHide quote
"Kyote" <kyote_love@nospamhotmail.com> schreef in bericht
news:cucp33dofgrgl35ha8tsb3js6jok2f7hmf@4ax.com...
> 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
Author
7 May 2007 8:26 AM
Kyote
On Sat, 5 May 2007 21:30:44 +0200, "Michel Posseth [MCP]"
<msn***@posseth.com> wrote:

>
>
>You might investigate my date entry control
>
>wich can handle db nulls and show a empty box and lots and loots more (
>investigate the property`s of the control )
>
>http://www.vbdotnetcoder.com/Downloads/Examples/AuthorMP/dateentry.zip
>
>i wrote this control for the company i work for , for simple date entry
>while still providing data binding ( the controls takes any entry that is
>valid for cdate  , 1-1 , 1 jan etc etc etc )
> it comes with a sample project and full sourcecode.

Thank you Michael. I just downloaded it and will look at the sample
project in a few minutes. From your reply to D2 I think you understand
exactly what I'm trying to do and that this will indeed solve my
problems.

>
>regards
>
>Michel Posseth


---
Kyote
Author
6 May 2007 6:58 AM
D2
On May 5, 9:47 pm, Kyote <kyote_l...@nospamhotmail.com> wrote:
> 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

While binding the control; you can handle the Parse and Format events
of the binding object. In your event handlers, your can set a
different value(default value when database has null). Right now i
dont have the sample code, you can find good samples at msdn.
Author
6 May 2007 7:46 AM
Michel Posseth [MCP]
Yes ,,

But afaik  you can`t set  the control  to a empty value when the db value
is a dbnull


Show quoteHide quote
"D2" <dhap***@yahoo.com> schreef in bericht
news:1178434700.377663.192590@y5g2000hsa.googlegroups.com...
> On May 5, 9:47 pm, Kyote <kyote_l...@nospamhotmail.com> wrote:
>> 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
>
> While binding the control; you can handle the Parse and Format events
> of the binding object. In your event handlers, your can set a
> different value(default value when database has null). Right now i
> dont have the sample code, you can find good samples at msdn.
>
Author
7 May 2007 4:32 AM
D2
Show quote Hide quote
On May 6, 12:46 pm, "Michel Posseth [MCP]" <msn***@posseth.com> wrote:
> Yes ,,
>
>  But afaik  you can`t set  the control  to a empty value when the db value
> is a dbnull
>
> "D2" <dhap***@yahoo.com> schreef in berichtnews:1178434700.377663.192***@y5g2000hsa.googlegroups.com...
>
> > On May 5, 9:47 pm, Kyote <kyote_l...@nospamhotmail.com> wrote:
> >> 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
>
> > While binding the control; you can handle the Parse and Format events
> > of the binding object. In your event handlers, your can set a
> > different value(default value when database has null). Right now i
> > dont have the sample code, you can find good samples at msdn.

correct! we usually set a default date/time for display... again when
saving back, check whether user has changed it or not.. if no then we
set null in the db.
Author
7 May 2007 11:09 AM
Jay Parzych
Show quote Hide quote
> On May 6, 12:46 pm, "Michel Posseth [MCP]" <msn***@posseth.com> wrote:
>
>> Yes ,,
>>
>> But afaik  you can`t set  the control  to a empty value when the db
>> value is a dbnull
>>
>> "D2" <dhap***@yahoo.com> schreef in
>> berichtnews:1178434700.377663.192***@y5g2000hsa.googlegroups.com...
>>
>>> On May 5, 9:47 pm, Kyote <kyote_l...@nospamhotmail.com> wrote:
>>>
>>>> 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
>>> While binding the control; you can handle the Parse and Format
>>> events of the binding object. In your event handlers, your can set a
>>> different value(default value when database has null). Right now i
>>> dont have the sample code, you can find good samples at msdn.
>>>
> correct! we usually set a default date/time for display... again when
> saving back, check whether user has changed it or not.. if no then we
> set null in the db.
>

this works:

http://www.codeproject.com/cs/miscctrl/NullableDateTimePicker.asp

you can customize your null value.  for example, i have lots of time columns
that are set later.  if null, they say Click To Set.  in the click event,
i set the value to the current time.