Results 1 to 7 of 7

Thread: array of byte to Mscomm.out?

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Location
    Jakarta
    Posts
    12

    array of byte to Mscomm.out?

    Hi all,
    I got an error massage on my following code
    VB Code:
    1. Private Sub Cmd_send_Click()
    2. For j = 0 To bytecount
    3. MSComm1.Output = char(j)
    4. Next
    5. End Sub

    pointing to the third line.
    can anybody explain me what is wrong?

    thank you

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: array of byte to Mscomm.out?

    Which error do you get?
    Frans

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Location
    Jakarta
    Posts
    12

    Re: array of byte to Mscomm.out?

    hi frans thank

    this is the massage:
    Run time error 380:
    Invalid property value

    see attachment
    thanks
    Attached Images Attached Images  

  4. #4
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: array of byte to Mscomm.out?

    How is the char variable defined (what is the type)?
    What is the value of j?
    What is the value of char(j)?
    Frans

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Location
    Jakarta
    Posts
    12

    Re: array of byte to Mscomm.out?

    the char variable:
    dim char(255) as byte
    value of j is byte
    the value of Char(j) is byte

    thanks Frans

  6. #6
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: array of byte to Mscomm.out?

    I think you misunderstood my last two questions.
    What is the value of j and char(j) at the moment you get the error.
    j must be 0 or bigger. I ask this because I want to know if it goes wrong immediately, or that it goes wrong at a later stage.
    char(j) should have a value between 0 and 255.
    Frans

  7. #7

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Location
    Jakarta
    Posts
    12

    Re: array of byte to Mscomm.out?

    Dear Frans,
    i think i have solve the problem.
    i read the article on microsoft library.
    it should be like this:

    msscomm1.ouput = char


    where char is an array variable.
    this mean i have another thing to do,
    because this code sends the whole data array.

    is there any other way to send array byte data via mscomm partially and not the whole array of byte?
    thank you

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