|
-
Jan 21st, 2003, 01:24 PM
#1
Thread Starter
Lively Member
new to vb.net and problems with RS232
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
-
Jan 21st, 2003, 04:55 PM
#2
Sleep mode
this example shows you how to convert any expression to Byte Type : from Integer ==>Byte
VB Code:
Dim byt As Integer = 100.12
MsgBox(CByte(byt))
What's RS232 anyways ? remember I was trying to help,don't have any idea about it though
-
Jan 21st, 2003, 05:01 PM
#3
Fanatic Member
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
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
-
Jan 21st, 2003, 06:52 PM
#4
Thread Starter
Lively Member
Progress
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....
Last edited by Incognito44; Jan 21st, 2003 at 07:21 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|