Name
CBool Function
Synopsis
CBool(expression
)
expression
required; String or NumericAny numeric expression or a string representation of a numeric value
Named Arguments
No
Return Value
expression
converted to Boolean data type
(True
or False
)
Description
Casts expression
as a Boolean data type.
When a numeric value is converted to Boolean, any nonzero value is
converted to True
, and zero is converted to
False
.
If the expression to be converted is a string, the string must be
capable of being evaluated as a number, or it must be
"True"
or "False"
. Any other
string generates an exception. For example,
CBool("one")
results in a type mismatch error,
whereas CBool("1")
is converted to
True
, and CBool("True")
is
converted to True
.
Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.