DateTimePicker + DataBinding + Null-Value: THE solution?

P

Pieter

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 would make the task
easier...

Thanks a loty in advance,

Pieter
 
C

Cor Ligthert [MVP]

Pieter,

You can take this sample, and than use instead of the textbox the
datetimepicker.

You have to change a little bit. The datetimepicker has to bind to the
property "value", while in some places where now the values are returned as
text should be returned as value. (Not to string by instance or and instead
of "" nothing)

http://www.vb-tips.com/default.aspx?ID=c4832a2a-2b95-4ded-93d9-4deb7fa4a0b8

I see that I use "datum" that is Dutch for date, maybe I will change that in
future to make it less confusing for you.

I hope this helps,

Cor
 
H

Herfried K. Wagner [MVP]

Pieter said:
I'm looking for a DateTimePicker that supports 100% databinding (and
support null-values)...

Untested:

<URL:http://www.grazioli.ch/Blog/PermaLink.aspx?guid=c4a63d35-71f9-4b02-9de7-0c87e5b1c770>

Nullable DateTimePicker
<URL:http://www.codeproject.com/cs/miscctrl/Nullable_DateTimePicker.asp>

(For a translation to VB.NET, take a look at the comments section of the
page.)

You may want to set the 'ShowCheckBox' property to 'True' and use the
checkbox as a null value indicator (if 'Checked' is 'False', no date is
selected). Notice that the 'ShowCheckBox' property is flawed and thus this
is not the best way.
 
J

Jay B. Harlow [MVP - Outlook]

Cor,
| I see that I use "datum" that is Dutch for date, maybe I will change that
in
| future to make it less confusing for you.
Why?

In english (at least US english): "datum" means a single piece of "data".

http://www.dictionary.net/datum

So in this case it "works".


--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| Pieter,
|
| You can take this sample, and than use instead of the textbox the
| datetimepicker.
|
| You have to change a little bit. The datetimepicker has to bind to the
| property "value", while in some places where now the values are returned
as
| text should be returned as value. (Not to string by instance or and
instead
| of "" nothing)
|
|
http://www.vb-tips.com/default.aspx?ID=c4832a2a-2b95-4ded-93d9-4deb7fa4a0b8
|
| I see that I use "datum" that is Dutch for date, maybe I will change that
in
| future to make it less confusing for you.
|
| I hope this helps,
|
| Cor
|
|
| "Pieter" <[email protected]> schreef in bericht
| | > 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 would make
the
| > task easier...
| >
| > Thanks a loty in advance,
| >
| > Pieter
| >
|
|
 
C

CMM

Yeah, technically "data" is a plural and only a plural. So correct usage is
to say "the data *are* wrong" or "the data *are* in that file." But, nobody
does that nowadays. "Data" is treated as singular noun. This was a pet-peeve
of an overly intellectual boss of mine a few years ago.
 
H

Herfried K. Wagner [MVP]

CMM said:
Yeah, technically "data" is a plural and only a plural. So correct usage
is to say "the data *are* wrong" or "the data *are* in that file." But,
nobody does that nowadays. "Data" is treated as singular noun. This was a
pet-peeve of an overly intellectual boss of mine a few years ago.

In German the singular is "das Datum" and the plural is "die Daten", but
"Datum" is rarely used in current German language for this purpose. Instead
it's mainly used equivalently to "date" in English.
 
C

Cor Ligthert [MVP]

Jay,

Thanks, I did not know that and find it fine to know.

In Dutch Datum is only used as a singulair for Date. The pluriform of that
is official Data. Although most people use Datums now to make it not more
confusing as it already is. Probably a nice shift in of the original meaning
of the word. I assume in English because for what Herfried wrote about the
German language. German is the second from the most important Germanic
languages while Dutch is the thirth (before you misunderstand English is the
first in that).

And because I like this, did I find your comment fine to know. Maybe I go
examine this deeper.

Cor
 
P

Pieter

Cor Ligthert said:
In Dutch Datum is only used as a singulair for Date. The pluriform of that
is official Data. Although most people use Datums now to make it not more
confusing as it already is.

Just one correction: In contrast to the people in the Netherlands, in
Belgium the people actually do know that they should use "data" as the
plural of "datum" which means "date" in english :p
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top