Convert.ToInt16 (Object) converts object to a 16-bit signed integer.
Module Example
Public Sub Main()
Dim values() As Object = { True, -12, 1163, 1.00e2}
Dim result As Short
For Each value As Object In values
Try
result = Convert.ToInt16(value)
Console.WriteLine(result)
Catch e As Exception
Console.WriteLine("Exception")
End Try
Next
End Sub
End Module
Related examples in the same category