Mega Code Archive

 
Categories / VB.Net / Data Types
 

Parse Hex string to Byte

Imports System.Globalization Imports System Module Example    Public Sub Main()       Dim values() As String = { Convert.ToString(12, 16), Convert.ToString(123, 16),Convert.ToString(245, 16) }       Dim mask As Byte = &hFE       For Each value As String In values          Dim byteValue As Byte = Byte.Parse(value, NumberStyles.AllowHexSpecifier)          Console.WriteLine("{0} And {1} = {2}", byteValue, mask, byteValue And mask)       Next             End Sub End Module