我定义了一个数组 dim bytData() as byte
                 dim dataRec as Variant
现在赋值
                 bytData=dataRec
然后我怎么判断bytData中有没有值呢?

解决方案 »

  1.   

    有人用VB的错误处理机制来做的.public function test(t() as byte) as boolean
      on error goto errhandle:
      dim i as integer
      for i=lbound(t) to lbound(t) 
         test=true
      next
      exit function
    errHandle:
      test=false
      

  2.   

    请查看我的文章:http://blog.csdn.net/tanaya/archive/2005/04/21/356939.aspx
    判断数组是否被分配的VB函数
      

  3.   

    还是帖出来吧:Function IsReDim(ByRef MyArray() As Variant) As Boolean
        On Error GoTo Z
        Dim szTmp
        szTmp = Join(MyArray, ",")
        IsReDim = LenB(szTmp) > 0
        Exit Function
    Z:
        IsReDim = False
    End FunctionIsReDim判断数组是不是被分配过,如果是动态数组被Erase了,将返回False使用例子:
    If IsReDim(uArray) Then
       'uArray里面有数据
    Else
       'uArray里面没有数据
    End If
    你用的时候只要这样调用就可以了:
    If IsReDim(bytData) Then
       'bytData里面有数据
    Else
       'bytData里面没有数据
    End If