Re-Use ByteArray? is that possible? How?

  • Thread starter Thread starter Michael Barrido
  • Start date Start date
M

Michael Barrido

Greetings I have the following code:

Dim binary_data As Byte() = {&HAA, &HD0, &H15, &HB, &H10, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H56}
objPort.Write(SerialNET.Port.ByteArrayToString(binary_data))

Now i want to re-use the bytearray variable "binary_data" to store new
values. Something like:

binary_data = {&HAA, &HD0, &H15, &HB, &H7F, &H10, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &HD7}

but it wont compile.
Can you please tell me how i can re-use "binary_data" to store new values?
Thanks in advance!
 
Michael Barrido said:
Greetings I have the following code:

Dim binary_data As Byte() = {&HAA, &HD0, &H15, &HB, &H10,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H56}
objPort.Write(SerialNET.Port.ByteArrayToString(binary_data))

Now i want to re-use the bytearray variable "binary_data" to store
new values. Something like:

binary_data = {&HAA, &HD0, &H15, &HB, &H7F, &H10, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &HD7}

but it wont compile.
Can you please tell me how i can re-use "binary_data" to store new
values? Thanks in advance!

Do you want to use the same array and put the new values in, or due you want
to create a new array containing the new values? To do the latter:

binary_data = new byte() {&HAA, &HD0, &H15, &HB, &H7F, &H10, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &HD7}


Armin
 
Michael Barrido said:
Dim binary_data As Byte() = {&HAA, &HD0, &H15, &HB, &H10, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H56}
objPort.Write(SerialNET.Port.ByteArrayToString(binary_data))

Now i want to re-use the bytearray variable "binary_data" to store new
values. Something like:

binary_data = {&HAA, &HD0, &H15, &HB, &H7F, &H10, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &HD7}

but it wont compile.
Can you please tell me how i can re-use "binary_data" to store new values?

\\\
BinaryData = New Byte() {...}
///
 
Thank you! :-)
Armin Zingler said:
Do you want to use the same array and put the new values in, or due you
want to create a new array containing the new values? To do the latter:

binary_data = new byte() {&HAA, &HD0, &H15, &HB, &H7F, &H10, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &HD7}


Armin
 
Thank you very much! it works!
Armin Zingler said:
Do you want to use the same array and put the new values in, or due you
want to create a new array containing the new values? To do the latter:

binary_data = new byte() {&HAA, &HD0, &H15, &HB, &H7F, &H10, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &HD7}


Armin
 
Back
Top