Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToUInt16 (String, Int32) converts string in a base to 16-bit unsigned integer

Class Sample    Public Shared Sub Main()         Dim value As String = Convert.ToString(Short.MinValue, 16)         Try            Dim number As UInt16 = Convert.ToUInt16(value, 16)            Console.WriteLine("0x{0} converts to {1}.", value, number)         Catch e As OverflowException            Console.WriteLine("OverflowException")         End Try                 End Sub  End Class