Software Components Home

VB6: Convert String to Byte Array

Back

Question:
How do I convert a string to a byte array in Visual Basic 6.0?

Answer:
To convert a string to a byte array, create a dynamic byte array. Set your string variable equal to the byte array.

         Dim strTest As String
         Dim bytArray() As Byte

         strTest = "This is my Visual Basic 6.0 test string to be converted into a byte array."
         bytArray = strTest