CType (Cast to Data Type)

The CType function is used to cast an expression into a specified data type.

Syntax

CType ( Expression, Type )

Remarks

This function returns the Expression as the data type specified by the Type parameter.

Parameters

Expression

The Expression parameter is the value or string that should be cast into the specified data type.

Type

Valid data types for the Type parameter are ClosedFloat Four-byte floating-point data type. Default datalogger data type for Public or Dim variables. Same format as IEEE4. (or ClosedIEEE4 Four-byte, floating-point data type. IEEE Standard 754. Same format as Float.), ClosedLong Data type used when declaring a variable as an integer., ClosedString A data type used when declaring a variable consisting of alphanumeric characters., or Double.