
Array to Variant and Variant to array problem
I am having real headaches with this one ! I am writing a winsock
application and want to send an integer array to the remote computer.
I've set my code as follows:
Dim TableData(26) as integer
Dim DataToSend as Variant
DataToSend = TableData <------- this seems to work fine
DataToSend = "D" & DataToSend
Call Send_Data(DataToSend)
On the receiving end........
Dim DataTable(26) as Integer
Dim DataReceived as Variant
Dim DataIn as Variant
If mid(DataReceived, 1, 1) = "D" then
DataIn = mid(DataReceived, 2, (BytesTotal -1))
DataTable = DataIn
This is where everything seems to go wrong. When I compile the
application I get an error message of "Can't assign to a non-byte
array". What does this mean ? Does anybody have a way to send an
entire array of integers as one peice of data and have it arrive on
the receiving end as an entire array of integers ? Or do I have to
create another table of strings = Str$(integer) and send that way and
then Val(string) = Integer on the receiving end ?
Thanks for your time,
Mike