The current daveReadByte Visual Basic declaration doesn't retrieve data in the buffer parameter.
The last parameter of daveReadBytes is a pointer to a buffer where to store a copy of read data. In fact, a pointer in VB uses to be managed with a long variable, but due to the internal nature of visual basic arrays you cannot pass an array and spect to retrieve data in it.
To solve this problem, the last parameter must be declared as "byref bytBuffer as byte" instead of "byval buffer as long". When the function is called, the first item of the buffer must be passed as parameter, just in the same way daveWriteBytes is called.
Example:
Dim bytBuffer (1 to 20) as byte
daveReadBytes DC, daveDB, 5, 1, 20, bytBuffer(1)
So, you would be reading 20 bytes of DB 5 starting at byte 1 and data would be stored in bytBuffer starting at byte 1
It's bee tested with possitive results. I hope it could be useful.
Regards.