User Defined Type (UDT) as parameter in public Sub in class module (VB6)

后端 未结 7 1133
感动是毒
感动是毒 2020-12-04 22:41

I\'ve tried to solve this problem, but can\'t find any solution. I have a UDT defined in a normal module, and wanted to use it as parameter in a Public Sub in a

相关标签:
7条回答
  • 2020-12-04 23:45

    Just define the sub as Friend scope. This compiles fine for me in a VB6 class.

    Private Type testtype
      x As String
    End Type
    
    
    Friend Sub testmethod(y As testtype)
    
    End Sub
    

    From your error messages it appears your class is private. If you do want your class to be public - i.e. you are making an ActiveX exe or DLL and you want clients to be able to access the sub - then just make both the type and the sub Public.

    0 讨论(0)
提交回复
热议问题