Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToInt16 (String, Int32) converts string in a specified base to 16-bit signed integer

Module Example    Public Sub Main()         Dim value As String = Convert.ToString(CInt(Short.MaxValue) + 1, 16)         Try            Dim number As Short = Convert.ToInt16(value, 16)            Console.WriteLine(number)         Catch e As OverflowException            Console.WriteLine("Unable to convert '0x{0}' to a 16-bit integer.", value)         End Try       End Sub End Module