Hello,
I'm trying to combine 2 byte arrays and then create a new byte array that contains the contents of both but running into a problem. The error says 'Source Array was not long enough.' I'm trying to combine HeaderByteArray and bytBuffer into newByteArray. I don't understand what Source Array is not long enough means and how to correct this. Could anyone offer some guidance? Thanks
Here is my code and the values for each line when running through the debugger:
Code:' 4343 Dim newArrayLength As Integer = (bytHeader.Length + bytBuffer.Length) - 1 Dim newByteArray(newArrayLength) As Byte ' bytHeader: Length=248 ' newByteArray: Length=4344 ' bytHeader.Length: 248 Array.Copy(bytHeader, newByteArray, bytHeader.Length) ' bytBuffer: Length=4096 ' newByteArray: Length=4344 ' bytHeader.Length=248 ' newByteArray.Length=4344 Array.Copy(bytBuffer, 0, newByteArray, bytHeader.Length, newByteArray.Length)




Reply With Quote