Getting “argument prompt cannot be converted to string error” while trying to test serial port communication in vb2008

Tag: serial-port Author: poposeven Date: 2012-07-22

I am using the following piece of code to send some data and receive it but i am getting the following error. I am using visual studio 2008 coding in vb

argument prompt cannot be converted to string error

Dim byteBuffers(2) As Byte

byteBuffers(0) = 8
byteBuffers(1) = 3
byteBuffers(2) = 6

rs232port.Write(byteBuffers, 0, 3)

Dim byteBuffer() As Byte = {0, 0, 0}
rs232port.Read(byteBuffer, 0, 3)
MsgBox(byteBuffer)

Can someone explain what is causing my error?

which line is causing the error?
Use MsgBox(BitConverter.ToString(byteBuffer))

Best Answer

First error: Your code isn't VBScript, so remove that tag and choose one appropriate for the dialect you use.

Second error: MsgBox expects a string (or something that can be converted to a string) as first parameter; your byteBuffer is neither nor.