Parse Hex Number String to Byte
Imports System.Globalization
Imports System
Module Example
Public Sub Main()
Dim string2 As String = "F9"
Try
Dim byte2 As Byte = Byte.Parse(string2,System.Globalization.NumberStyles.HexNumber)
Console.WriteLine(byte2)
Catch e As OverflowException
Console.WriteLine("'{0}' is out of range of a byte.", string2)
Catch e As FormatException
Console.WriteLine("'{0}' is out of range of a byte.", string2)
End Try
End Sub
End Module
Related examples in the same category