Convert.ToInt32 (Single) converts single-precision floating-point number to 32-bit signed integer.
Module Example
Public Sub Main()
Dim values() As Single = { Single.MinValue, 0, 9.113e-16, Single.MaxValue }
Dim result As Integer
For Each value As Single In values
Try
result = Convert.ToInt32(value)
Console.WriteLine( result)
Catch e As OverflowException
Console.WriteLine("{0} is outside the range of the Int32 type.", value)
End Try
Next
End Sub
End Module
Related examples in the same category