Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToInt64 (Single) converts single-precision floating-point number to 64-bit signed integer

Module Example    Public Sub Main()         Dim values() As Single = { Single.MinValue, -1.38e10, 0, 9.111e-16, 111.111, 2010.191, Single.MaxValue }         Dim result As Long                  For Each value As Single 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