Convert.ToInt64 (Decimal) converts decimal number to 64-bit signed integer.
Module Example
Public Sub Main()
Dim values() As Decimal = { Decimal.MinValue, -1034.23d, -12d, 0d, 147d, _
199.55d, 1111.16d, Decimal.MaxValue }
Dim result As Long
For Each value As Decimal In values
Try
result = Convert.ToInt64(value)
Console.WriteLine(result)
Catch e As OverflowException
Console.WriteLine("{0} is outside the range of the Int64 type.", _
value)
End Try
Next
End Sub
End Module
Related examples in the same category