Anda di halaman 1dari 5

Casting/Konversi data pada VB.

NET
CBool()
Mengubah ke tipe data Boolean
CByte()
Mengubah ke tipe data Byte
CChar()
Mengubah ke tipe data Char
CDate()
Mengubah ke tipe data Date
CDec()
Mengubah ke tipe data Decimal
CInt()
Mengubah ke tipe data Integer
CLng()
Mengubah ke tipe data Long
CObj()
Mengubah ke tipe data Object
CShort()
Mengubah ke tipe data Short
CStr()
Mengubah ke tipe data String

CBool
Returns
Boolean

Description
Convert expression to Boolean.
Range for expression argument:
Any valid string or numeric expression.

CByte

Returns
Byte

Description
Convert expression to Byte.
Range for expression argument:
0 to 255.

CCur
Returns
Currency

Description
Convert expression to Currency.
Range for expression argument:
-922,337,203,685,477.5808 to 922,337,203,685,477.5807.

CDate
Returns
Date

Description
Convert expression to Date.
Range for expression argument:
Any valid date expression.

CDbl
Returns
Double

Description
Convert expression to Double.
Range for expression argument:
-1.79769313486232E308 to -4.94065645841247E-324 for negative values;
4.94065645841247E-324 to 1.79769313486232E308 for positive values.

CDec
Returns
Decimal

Description
Convert expression to Decimal.
Range for expression argument:
+/-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no
decimal places. For numbers with 28 decimal places, the range is +/7.9228162514264337593543950335. The smallest possible non-zero number is
0.0000000000000000000000000001.

CInt
Returns
Integer

Description
Convert expression to Long.

Range for expression argument:


-32,768 to 32,767; fractions are rounded.

CLng
Returns
Long

Description
Convert expression to Long.
Range for expression argument:
-2,147,483,648 to 2,147,483,647; fractions are rounded.

CSng
Returns
Single

Description
Convert expression to Single.
Range for expression argument:
-3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive
values.

CStr
Returns
String

Description
Convert expression to String.
Range for expression argument:
Returns for CStr depend on the expression argument.

CVar
Returns
Variant

Description
Convert expression to Variant.
Range for expression argument:
Same range as Double for numerics. Same range as String for non-numerics.