473,321 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Instantiate a byte array with hex values

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!
Apr 11 '06 #1
2 13658
"Raterus" <ra*****@hotmail.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Apr 11 '06 #2
Thanks, that work great! It's so hard to search for things like that!!

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message news:ec**************@TK2MSFTNGP02.phx.gbl...
"Raterus" <ra*****@hotmail.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David Cook | last post by:
Java's InetAddress class has some methods that use a byte-array to hold what it describes as a 'raw IP address'. So, I assume that they mean an array like: byte ba = new byte; would hold an...
19
by: jeff | last post by:
how do you convert form byte to Int32 while retaining the binary value of the byte array
4
by: cjw | last post by:
I need to read an 'unsigned char' array and save it as a bit array (values are only 0s or 1s). When processing, have to do math operations such as summing up the values etc. Pl let me know an...
8
by: Dmitri Shvetsov | last post by:
Hi All, Did somebody try to get the Hash code from byte array? The method exists, the program is compilable but...))) Try!-) Every time you can get the different code from the same array, and...
6
by: Aaron | last post by:
How converts a string to a byte and then add it to a byte array? I tried 2 different methods and both failed to work. For example: Dim A as string Dim B(2) as Byte 'array (from 0 to 2) ...
6
by: moondaddy | last post by:
I'm writing an app in vb.net 1.1 and need to convert a byte array into a string, and then from a string back to a byte array. for example Private mByte() as New Byte(4){11,22,33,44} Now how...
7
by: Vince Panuccio | last post by:
Hello, If im looking for a pattern of byes in a byte array, what would be the best approach? I could convert the array into a string and use IndexOf recursivly by remembering the last...
24
by: ThunderMusic | last post by:
Hi, The subject says it all... I want to use a byte and use it as byte* so I can increment the pointer to iterate through it. What is the fastest way of doing so in C#? Thanks ThunderMusic
10
by: Scott Townsend | last post by:
So I need to talk to a devices that expects all of the bits and bytes I sent it to be in specific places (not yet 100% defined). I wanted to create a structure/class with all of the data in it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.