cmdolcet69 said:
Public ArrList As New ArrayList
Public bitvalue As Byte()
Public Sub addvalues()
Dim index As Integer
ArrList.Add(100)
ArrList.Add(200)
ArrList.Add(300)
ArrList.Add(400)
ArrList.Add(500)
For Each value As Integer In ArrList
bitvalue = BitConverter.GetBytes(value)
'I need to convert the Hex value back to its corresponding decimal
value and place it into the bitvalue (0) and bitvalue (1)
senddata(bitvalue(0), bitvalue(1))
Next
End Sub
Before I just saw your own answer to you own question, I was thinking you
are trying to fool us by asking this question. Sorry.
Though, as I don't
want to discard the answer that I wrote meanwhile, here it is: ;-)
I don't see a hex value in the code. Hex values are strings. You do not have
a string in the code. Therefore, there can not be a hex value, and there is
nothing to convert.
Ok, let's start from the beginning:
In electronic data processing, in the digital world, information is stored
and transmitted using bits as the smallest unit of information. A bit can be
0 or 1, on or off, true or false. These are different, human readable words
for the two states a bit can be.
If you put 8 bits together, you get a byte. A byte can have 256 different
bit combinations. What kind of information is stored in a byte is a matter
of interpretation. For example, you can use 7 bits to store a numeric value
and 1 bit as the sign of the value, so you can store the values -128 to 127.
Without a sign, the values are 0 to 255.
The value stored in a byte can also be the code of a character. Due to
standardization, we are able to correctly interpret which character code
corresponds to which char. For example, the value 65 is the capital letter
"A". There are different character code standards. The table that describes
the relation between character code and character is called a code page. So,
one character can have different character codes in different code pages. In
the .Net Framework (and in VB.Net), two bytes are used to store a character.
The used code page is Unicode. This is necessary to support all the
characters used worldwide because two bytes can have 65,536 different
values.
When we talk about binary, octal, decimal and hexadecimal, we refer to the
human readable representation of a value that is stored in one or several
bits or bytes.
For example, let's take the binary value 1111011.
binary: 01111011
octal: 173
decimal: 123
hex: 7B
This is always the same value. As you can read this on your screen, you are
reading text. Texts are strings. This means, the value has been converted to
four different human readable strings using four different numeric bases (2,
8, 10 and 16).
Armin