O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

CDbl Function

Syntax

CDbl(expression)
expression

Use: Required

Data Type: Numeric or String

-1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values.

Return Value

expression cast as a Double type.

Description

Converts expression to a Double type.

Rules at a Glance

  • If the value of expression is outside the range of the double data type, an overflow error is generated.

  • Expression must evaluate to a numeric value; otherwise, a type mismatch error is generated.

Example

Dim dblMyNumber as Double
If IsNumeric(sMyNumber) then
    dblMyNumber = CDbl(sMyNumber)
End If

Programming Tips and Gotchas

Use IsNumeric to test whether expression evaluates to a number.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required