Results 1 to 5 of 5

Thread: How to create an array of bytes?

  1. #1
    jimmy1981 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Nov 2011
    Posts
    24
    Reputation
    21

    How to create an array of bytes?

    I have a bluetooth pen that I need to send an array of bytes too, can somebody offer advice on how i create an array of bytes for the following:0x68 0x00 0x02 0xFF 0x0A (in the guide this is the array of bytes I need to send)Thanks.

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    11,364
    Reputation
    1544
    The same way you create any other array. This is just one way:
    Dim bytes = New Byte() {&H68, &H00, &H02, &HFF, &H0A}

  3. #3
    jimmy1981 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Nov 2011
    Posts
    24
    Reputation
    21
    Thank you very much

  4. #4
    jimmy1981 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Nov 2011
    Posts
    24
    Reputation
    21
    Can you please explain why 0x is replaced with the &H?

  5. #5
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    11,364
    Reputation
    1544

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking