MSCOMM1.OUTPUT=&HFE,这样会出现类型不匹配,怎么办?急啊~

解决方案 »

  1.   


    Dim sj(0) AS Byte
    sj(0) = &HFE
    MsComm1.Output = sj
      

  2.   

    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.If you have data that contains embedded control characters, Null characters, etc., then you will want to pass it as binary data.Output Property Example
    The following example shows how to send every character the user types to the serial port:Private Sub Form_KeyPress (KeyAscii As Integer)
       Dim Buffer as Variant
       
       ' Set and open port
       MSComm1.CommPort = 1
       MSComm1.PortOpen = True   Buffer = Chr(KeyAscii)
       MSComm1.Output = Buffer
    End Sub