Results 1 to 4 of 4

Thread: new to vb.net and problems with RS232

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Posts
    98

    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

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    this example shows you how to convert any expression to Byte Type : from Integer ==>Byte

    VB Code:
    1. Dim byt As Integer = 100.12
    2. MsgBox(CByte(byt))

    What's RS232 anyways ? remember I was trying to help,don't have any idea about it though

  3. #3
    Fanatic Member
    Join Date
    May 2001
    Posts
    837
    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.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Posts
    98

    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
  •  



Click Here to Expand Forum to Full Width