On Sat, 26 Jun 2004 04:12:13 -0400, "Rick Rothstein"
<ri************@NOSPAMcomcast.net> wrote:
<snip>
Go to
Project/Components in VB's IDE menu and select Microsoft Windows Common
Controls-2 6.0; it's in the group of controls that get added. The
DatePicker control will allow your user to pick the date from a calendar
display where there can be no confusion as to what was entered (and only
valid date values are permitted to be entered, so there is no validation
checking required).
Gawd, what a horrible control.
Since I have had users entering dates into my Apps since 1977, I can
safely say that using that type of approach would have cut their
productivity by 50% - at least
- I can think of certain clients who would have lynched me
My approach is different.
Let them enter anything they want in there
- 1.1.01
- 010101
- 1-1-1
- 1/1/1
- C - Today
- C+1 - Tomorrow
Then decifer it and reformat it in a sensible manner
Then /redisplay/ it eg: 01-01-2001
Then (if possible) do 'sanity checks'
If the date is 'internally invalid' eg: 32nd August, then show the
punter what they have entered, tell them 'INVALID DAY' in red in a
Label, and let them edit it to get it right.
The thing about the people at Microsoft is that they have no
experience of fast bulk data entry.
I do however, totally agree that IsDate will decide that the most
peculiar things are valid dates, and CDate compounds the problem.
I have posted what I use a few times
Here is a link:
http://tinyurl.com/yt53h
It is extremely old code, but I find it utterly reliable (up to some
leap year in about 2100)
Also it is for the European date format, but that is easily tweaked