Public Function StrToByteArray(ByVal str As String) As Byte() Dim encoding As New System.Text.UTF8Encoding() Return encoding.GetBytes(str) End Function 'StrToByteArray Public Function ByteArrayToStr(ByVal byteArray As Byte()) As String Dim str As String Dim enc As New System.Text.UTF8Encoding() str = enc.GetString(byteArray) Return str End Function