Pages

Men

rh

7/01/2012


How do I convert one DataType to other using the CType Function?
The CType is pretty generic conversion Function.

The example below demonstrates using a CType Function to convert a Double value to an Integer value.
Module Module1
Sub Main()
Dim d As Double
d = 132.31223
Dim i As Integer
i = CType(d, i)
'two arguments, type we are converting from, to type desired
System.Console.Write("Integer value is" & i)
End Sub
End Module

No comments :

Post a Comment