Hi Erel,
I see the problem, but not yet the solution. Yesterday I was sleepy and confused by the line number. I thought 'registration', what registration? Registrationmsg is a structure I declared myself; s is a String.
Part of the code is as follows:
Type registrationmsgstruct(length As Long,src As Byte, ack As Byte, eleccountday As Long, eleccountnight As Long, elecconsumption As Long, gasdatetime(13) As Char, gascount As Long, msgnr As Byte)
Dim registrationmsg As registrationmsgstruct
Sub AStream_NewData (Buffer() As Byte)
Dim s As String = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
registrationmsg = s This is the line which gives the problem, I assume. The buffer should be copied to the structure as a serie of bytes. The length is exactly the same.
How can I do that? A kind of memcpy would be usefull. On internet I find something like that, but then I need the Class System, which I cannot find. Also a complete sample would be nice.
Harry