Convert.ToInt16 (Double) converts double-precision floating-point number to 16-bit signed integer.
Module Example
Public Sub Main()
Dim values() As Double = { Double.MinValue, -1.38e10, Double.MaxValue }
Dim result As Short
For Each value As Double In values
Try
result = Convert.ToInt16(value)
Console.WriteLine("Converted {0} to {1}.", value, result)
Catch e As OverflowException
Console.WriteLine("{0} is outside the range of the Int16 type.", value)
End Try
Next
End Sub
End Module
Related examples in the same category