mscomm.inputmode 写的什么?用的是text模式的是么?
st = System.Text.Encoding.Ascii.GetBytes(obj);

解决方案 »

  1.   

    System.Text.Encoding.Ascii.GetBytes()中应该为字符数组,obj转换不过来,怎么办呢,我没有设mscomm.inputmode 因为以前设的时候总是出错。应该怎么设呀??
      

  2.   

    this.axMSComm1.InputMode=MSCommLib.InputModeConstants.comInputModeBinary;  //字节
    this.axMSComm1.InputMode=MSCommLib.InputModeConstants.comInputModeText;    //字符byte[] temp=(byte[])this.axMSComm1.Input;  //就是字节数组了,不需指定大小