Converting Data Types

Visual Basic provides several conversion functions you can use to convert values into specific data types. To convert a value to Currency, for example, you use the CCur function.


payPerWeek = CCur(hours * hourlyPay)

Conversion function

Converts an expression to

CBool

Boolean

CCur

Currency

CDate

Date

CDbl

Double

CInt

Integer

CLng

Long

CSng

Single

CStr

String

CVar

Variant

CVErr

Error


For more information, see the specific conversion function in Help.