CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Byte & MSComm

  1. #1
    Join Date
    May 2001
    Location
    Syria, Damascus
    Posts
    16

    Byte & MSComm

    How Can I send a Byte using MSComm from visual Basic? Please provide code.

    Eng. Saleh Diab
    MCP, MCSA Charter Member, MCSE
    [email protected]
    www.salehd.8m.com

  2. #2

    Re: Byte & MSComm

    on MSDN I found this:

    The Output property can transmit text data or binary data. To send text data using the Output property, you must specify a Variant that contains a string. To send binary data, you must pass a Variant which contains a byte array to the Output property.

    Normally, if you are sending an ANSI string to an application, you can send it as text data. If you have data that contains embedded control characters, Null characters, etc., then you will want to pass it as binary data.

    I think U can try so:

    dim mybyte as byte
    mybyte=1

    '{...}

    myMSCOMM.output = mybyte

    else using bytes array

    dim mybyte_array(1) as byte
    mybyte_array(1)=1

    '{...}

    myMSCOMM.output = mybyte_array

    hi,brt

    <center>
    <HR width=80%>
    <img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
    </center>

  3. #3
    Join Date
    May 2001
    Location
    Syria, Damascus
    Posts
    16

    Re: Byte & MSComm

    Thanks but this didn't work, I had a type mismatch error

    Eng. Saleh Diab
    MCP, MCSA Charter Member, MCSE
    [email protected]
    www.salehd.8m.com

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

Featured