Discussion:
Boolean Variable
(too old to reply)
Tom Lavedas
2003-08-07 15:55:14 UTC
Permalink
Dim bVariable ' as boolean

All variables are of type Variant in scripting, so you
can't actually create a boolean (notice informational
comment at end of DIM statement). It can only be
subtyped - and then only by typecasting using an
equivalence statement, as in ...

bVariable = False ' now its a variant, subtype boolean

If you're having troubles with a type mismatch from a roll-
your-own control, it can only be fixed by revising your
control to return only variants.

Tom Lavedas
===========
-----Original Message-----
How do I dimension a Boolean variable in a VB Script?
Joe Earnest
2003-08-07 16:04:53 UTC
Permalink
Hi,
How do I dimension a Boolean variable in a VB Script?
All VBS variables are variants, and there are no initial type declarations.
When used in a Boolean operation, the initial Empty assignment will be
coerced to False (either dual-state or long integer numeric 0). Subtypes
are created when assigned. You can assign dual-state booleans directly,
using the True or False functions, comparisons, etc. The vbTrue and vbFalse
constants are actually long integer subtype numeric booleans, set to 0
or -1. If you need to insure that you have a boolean dual-state variable
for other assignments, use CBool.

Joe Earnest
John Ford
2003-08-07 16:07:51 UTC
Permalink
Dim bolMyFlags(9) ' zero-based array w/10 elements
For Each bolTemp in bolMyFlags
bolTemp = False
Next

--
jcf
"Richard Pidcock" <***@eds.com> wrote in message news:0cd301c35cf9$e3b52ee0$***@phx.gbl...
| How do I dimension a Boolean variable in a VB Script?

Loading...