在VB中如何得到一个数组的大小?包括是空数组

解决方案 »

  1.   

    你是指什么意思?
    用UBound(arrary)和LBound(arrary)得到数组的上界和下界,然后乘上数组元素所占的字节数.
    不知是否是你要的?
      

  2.   

    不是这样的,看下面的程序:Dim a() As Integer
    Dim i As Integer
    i = UBound(a)如果a没有被重新定义大小,则程序会出错怎么知道a没有定义大小?
      

  3.   

    用错误处理
    on error goto w
    Dim a() As Integer
    Dim i As Integer
    i = UBound(a)
    exit sub
    w: