我在一个标准模块中定义个public的type
然后在一个类模块的public方法中声明一个这个type的变量作为参数,编译出错:
Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types
请问该如何解决?

解决方案 »

  1.   

    首先,看看是不是有这个type名。
    其次,当然看有没有定义错了咯。
    不过一楼帮你顶。
      

  2.   

    Public Type SysOptions  
      name as string
      Meno as string
    end typePublic Options As SysOptions
      

  3.   

    谢谢
    type名没错
    这两个模块都是我从另一个工程里弄过来的,在另一个工程里的时候用得好好的,不明白怎么回事。
      

  4.   

    建个公共的新类,然后把Type声明放到那里去,不要放在标准模块里
      

  5.   

    请问如何建公共的新类?我用project->add class module
    然后定义,出错:
    cannot define a public user-defined within a private object module
      

  6.   

    把类的Instancing属性改成GlobalMultiUse看看
      

  7.   

    自定义的类型是不能作为函数(or过程)参数传递的,
    你可以重新定义一个相应的类,或者在传递参数是象一些api一样:传递结构的第一个参数的地址,在函数(or过程)中把类型还原出来。