请问VB6的串口通信控件的inputlen属性指的是什么,怎么用?
指的是不是input buffer中的有效字节数,还是每次我从input buffer中读的字节的个数?
还有vbcrlf代表什么?
是CR+LF,还是CR,还是LF,我怎么做区分?如果我用文本方式获取串口input buffer 中的值,那么vbcrlf指的是什么?
我是想读串口中的数据,如“abc”+ vbcrlf,我怎么保证能够读完整?

解决方案 »

  1.   

    inputlen属性返回一个整型表达式,说明 Input 属性从接收缓冲区中读取的字符数。该例子说明如何读取 10 个数据字符:Private Command1_Click()
    Dim CommData as String
    ' 确定一个10个字符的数据块。
    MSComm1.InputLen = 10
    ' 读数据。
    CommData = MSComm1.Input
    End Sub
      

  2.   

    请问VB6的串口通信控件的inputlen属性指的是什么,怎么用?
    指的是不是input buffer中的有效字节数,还是每次我从input buffer中读的字节的个数?InputLen:输入缓冲区内现存字节数.
    用法:
    比如在On_Comm事件中: 
    if mscomm1.inputlen<6 then exit sub          '缓冲区字符少于6个则退出,大于等于6个时才接收
    vTemp=Mscomm1.Input                          'Input从缓冲区读出字节,且清空缓冲区还有vbcrlf代表什么?                         '回车换行符如果我用文本方式获取串口input buffer 中的值,那么vbcrlf指的是什么?//VBCRLF:回车换行符我是想读串口中的数据,如“abc”+ vbcrlf,我怎么保证能够读完整?//判断当前收接的字符是否为VBCRLF,如果是,就从它之间截取,我写个示例:
    private sub  MScomm1_OnCOMM()
      dim vTmp as variant
      dim nTmp as integer
      static sTmp as string
      vTmp=MScomm.Input
      sTmp=Stmp & cstr(vTmp)              '将接收的数据合并
      nTmp=instr(1,sTmp,Vbctlf)
      if nTmp=0 then exit sub             '没有回车换行符,表示没有接收全数据
      msgbox sTmp
    end sub
      

  3.   

    请问VB6的串口通信控件的inputlen属性指的是什么,怎么用?
    指的是不是input buffer中的有效字节数,还是每次我从input buffer中读的字节的个数?InputLen:准备读取字节数.
    用法:
    比如在On_Comm事件中: 
    MSComm1.InputLen=6         '只读出6个字节
    vTemp=Mscomm1.Input                          'Input从缓冲区读出字节对不起,上面的我错了.
      

  4.   

    private sub  MScomm1_OnCOMM()
      dim vTmp as variant
      dim nTmp as integer
      static sTmp as string
      vTmp=MScomm.Input
      sTmp=Stmp & cstr(vTmp)              '将接收的数据合并
      nTmp=instr(1,sTmp,Vbctlf)
      if nTmp=0 then exit sub             '没有回车换行符,表示没有接收全数据
      msgbox sTmp
      sTmp=""
    end sub