B4J Question string to bytes confusion

saunwin

Active Member
Licensed User
Longtime User
Hi Guru's,

Please help.
I have a text box containing some numbers. I need to turn these (Hex) numbers into a byte array to ship out of a com port.
Text box contains - 50750F
so my byte array b() needs to contain
50,75,0F


Dim b() As Byte
x = UIDField3.Text.SubString2(0,2)
strtemp= x & ","
x = UIDField3.Text.SubString2(2,4)
strtemp= strtemp & x & ","
x = UIDField3.Text.SubString2(4,6)
strtemp= strtemp & x & ","

' So at this point my string is "50,75,0F"

Dim bc As ByteConverter
b()=bc.StringToBytes(strtemp,1)

Am I on the wrong track here ?
Thanks in advance.
 

saunwin

Active Member
Licensed User
Longtime User
I knew there'd be a simple answer somewhere (I am learning :)) - Many Thanks Erel (Code tags duly noted). I'm lovin' playing with this software !!
 
Upvote 0
Top