Instantiate a byte array with hex values

  • Thread starter Thread starter Raterus
  • Start date Start date
R

Raterus

I'm trying to do something like this, but can't get the syntax correct, can someone help?

Dim myBytes() As Byte = {0x2b, 0x0c, 0x02, 0x87, 0x73, 0x1c, 0x00, 0x85, 0x4A}

Thanks!
 
Raterus said:
Dim myBytes() As Byte = {0x2b, 0x0c, 0x02, 0x87, 0x73,
0x1c, 0x00, 0x85, 0x4A}

\\\
Dim Bytes() As Byte = {&H2B, &HC, &H2, &H87, ...}
///

Simply replace '0x' with '&H' and remove leading zeros.
 
Thanks, that work great! It's so hard to search for things like that!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top