MSComm   msc1
设置如下
      .CommPort  1
      .Settings  4800,N,8,1
      .SThreshold   1
      .InputMode   ComInputModeBinary   comInputModeText 究竟该设哪一个?我现在要读取的是整数
 
'接收数据
Private Sub MSC1_OnComm()
    
    With MSC1
        Select Case .CommEvent
            Case 2
               这一部分该如何写?我现在要把读到的数据字显示到text1中                
        End Select
    End With
End Sub

解决方案 »

  1.   

    text1.text=text1.text & msc1.input
      

  2.   

    ComInputModeBinary   comInputModeText 
    那要看你发送的是二进制格式还是ASCII格式,试试就行了
      

  3.   

    首先你要清楚地磅传过来的是什么进制的数据,我最近在写与单片机通讯的程序,单片机传过来的是十六进制数据,我的接收代码如下:dim a as varient,b() as byte
    dim i as integer
    with MSComm 
          .CommPort  1
          .Settings  4800,N,8,1
          .InputMode   ComInputModeBinary
          .portopen=true
    end with
    a=mscomm.input
    b=a
    for i=0 to ubound(b)
       
    debug.print b(i) 
     '这里可以得到十进制表示的二制数字(0-255)若有需要你可以转为ASCII码用来显示字符  next