Click to See Complete Forum and Search --> : new to vb.net and problems with RS232
Incognito44
Jan 21st, 2003, 12:24 PM
I'm using an RS232 Class I found, the problem lies with the objRS232.Write()
I want to send a string as in objRS232.Write ("D" & chr(20))
The intellisense tells me that
objRS232.Write is expecting Buffer() as byte
objRS232(Buffer as byte())
Can anyone tell me how to send my charactor string as byte
thx Gregg
Pirate
Jan 21st, 2003, 03:55 PM
this example shows you how to convert any expression to Byte Type : from Integer ==>Byte
Dim byt As Integer = 100.12
MsgBox(CByte(byt))
What's RS232 anyways ?:D remember I was trying to help,don't have any idea about it though:p
DNA7433
Jan 21st, 2003, 04:01 PM
i saw this somewhere and i think this might be what your actually looking for
system.Text.Encoding.ASCII.GetBytes()
just pass in your string and it'll turn it into a byte array
Incognito44
Jan 21st, 2003, 05:52 PM
DNA7433,
Thanks, That seemed to cure one problem, it was complaining about not being a byte array.
I'm still not getting a response from the RS232 device, so I'm not sure if I'm not retrieving correctly or the write is not being interpreted correctly
objRS232.Write(System.Text.Encoding.ASCII.GetBytes("D" & chr(10)))
Will play with it some more.....
I suspect the USB to serial adapter is not 100% kosher....
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.