Re: Val() versus CLng, CInt or CByte
- From: "Steve Gerrard" <mynamehere@xxxxxxxxxxx>
- Date: Mon, 29 Oct 2007 21:21:38 -0700
"Jack" <replyto@it> wrote in message
news:e%23n6WrpGIHA.6068@xxxxxxxxxxxxxxxxxxxxxxx
Hello,
Which is preffered:
Val() or CLng () CInt,CByte
?
Using Val() is very convenient, because it accommodates all other numeric
dimensions.
Are there any restrictions or negatives of using it?
If there are, when should I use Val() and when the others?
Yours thoughts, please
Jack
CLng, et.al., are locale aware, so when in Rome, they will do as the Romans.
That is, they will recognize the use of comma as a decimal point, and period as
a thousand separator, in those locales where they do that. They are also
reasonably self documenting.
Val is nice because it it will read a number followed by text, i.e. 23A becomes
23, instead of tossing up an error. Since it returns a double, there will be an
implicit type conversion of the result to the actual desired type.
Depends on what you want/need.
.
- Follow-Ups:
- Re: Val() versus CLng, CInt or CByte
- From: Pop`
- Re: Val() versus CLng, CInt or CByte
- From: Donald Lessau
- Re: Val() versus CLng, CInt or CByte
- References:
- Val() versus CLng, CInt or CByte
- From: Jack
- Val() versus CLng, CInt or CByte
- Prev by Date: Val() versus CLng, CInt or CByte
- Next by Date: Re: where to get vb 6
- Previous by thread: Val() versus CLng, CInt or CByte
- Next by thread: Re: Val() versus CLng, CInt or CByte
- Index(es):
Relevant Pages
|