Well, VB6 can figure it out just fine from the format string. <It> knows how
to parse the format string and it <certainly> can recognize a date format
string, and it will recognize that the value is a number that can then be
converted into a date. I know VB.NET isn't VB6, but its supposed to be
BETTER, not worse.
As to your question, I don't literally call Format with some number and a
hard-coded date format string. If I did that then it would be rather obvious
to be that it was a date and I could convert it accordingly. I actually get
a list of values (actually as strings) and a list of format strings from
somewhere and I need to format the numbers according to those format strings
that I was given. Unfortunately, even if I <do> figure out whether or not is
a date, it may be in one of the string formats, or as a number. I was just
trying to simplify my question by skipping the parts about how I get the
values, which are not relevant to the actual question.
Thanks for your help anyway. I'd already decided that it can't do what I
need, I was just seeking other opinions. You never know if someone has
already figured it out.
As an aside, its this kind of stuff that makes VB.NET a pain in the ass. Its
so superior to VB6 in so many ways that it saves gobs of time, but then I
spend weeks on end sorting out the stuff that was trivial in VB6. Without
going into those problems, lets just say I didn't spent <that> much time on
this issue.
- Steve
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Hi Steve,
The bad news is that if <you> don't know whether you've got a date or
just a number, VB.NET <certainly> won't know. And VB.NET doesn't like not
knowing what it's dealing with. Very cagey it is about that sort of thing.
So the question has to be turned around and become how do you
determine what you've got so that you <can> convert into date format?
I'm curious. How do you get to your Format (SomeNumber, "dd MMM yyyy")
without knowing what your dealing with ? And what would your VB6 app do
with the result?
Regards,
Fergus