我自己定义了一个集合对象,在调试的时候可以正常运行,为什么编译成exe总是报“对象变量未定义”的错误。
我采用的是三层结构的模式,集合放在dll里面的。
用户端如此定义:
dim x as new xCollection
if x.count>0 then 
---这样就报错了。

解决方案 »

  1.   

    Dim x As New Collection
      

  2.   

    Dim x As New Collection
      

  3.   

    你再看看,Collection 不是 xCollection 
    实在不行,添加一个,模块,模块里写Dim x As New Collection 
      

  4.   

    我的程序结构大致如下:
    在dll中定义了两个类。
    class1中定义集合的属性和方法。
    public function yyy(参数)as class1
       '数据写入集合
    end functionclass2的方法使用了class1的集合。
    public function xxx () as class1
       dim x as new class1
       ...
       set xxx =x.yyy(参数)
    end function用户端事件:
    private sub ttt()
       dim x as new class1
       for i=1 to x.xxx.count  '这个地方在调试的时候是没有问题的,编译也行,但编译的exe运行时要报错,“对象变量为定义”
       '读取集合
       next
    end sub请教怎么解决?
      

  5.   


      dim x as new class1 
      for i=1 to x.xxx.count 
    ”xxx是class2的方法。class1类型的变量x,直接用class2的方法。x.xxx能通过编译?不能够相信
      

  6.   

    在 DLL 的工程属性中要选用二进制兼容方式,并且先编译 dll,再编译 exe。
      

  7.   

    xxx是class2的方法。class1类型的变量x