通过COM从VB6访问嵌套的VB.NET类

通过COM从VB6访问嵌套的VB.NET类,vb.net,dll,vb6,wrapper,inner-classes,Vb.net,Dll,Vb6,Wrapper,Inner Classes,我有两个来自制造商的.NET DLL,我必须在VB6项目中实现它们。为此,我开始在VB.net中为它编写包装 我不想只包装函数。。。我想在VB6项目中使用dll的类。我在VB.net包装器DLL中构建了一个COM类,VB6项目确实很好地识别了它 问题是,当我创建嵌套类时,VB6项目只识别顶部的类,而不识别类中的类 DLL已经注册,我使用了REGASM给我的TLB文件 以下是我的一些尝试: 尝试1: <ComClass(CHRABer.ClassId, CHRABer.InterfaceId

我有两个来自制造商的.NET DLL,我必须在VB6项目中实现它们。为此,我开始在VB.net中为它编写包装

我不想只包装函数。。。我想在VB6项目中使用dll的类。我在VB.net包装器DLL中构建了一个COM类,VB6项目确实很好地识别了它

问题是,当我创建嵌套类时,VB6项目只识别顶部的类,而不识别类中的类

DLL已经注册,我使用了REGASM给我的TLB文件

以下是我的一些尝试:

尝试1:

<ComClass(CHRABer.ClassId, CHRABer.InterfaceId, CHRABer.EventsId)>
Public Class CHRABer
    '"Here are the COM-GUIDs"
    Public Sub New()
        MyBase.New()
    End Sub
    Public Structure Test245
        Dim a As Integer
    End Structure

    <ComClass(Volta_Test.ClassId, Volta_Test.InterfaceId, Volta_Test.EventsId)>
    Public Class Volta_Test
        '"Here are the COM-GUIDs"
        Public Sub New()
            MyBase.New()
        End Sub
        Dim a As Integer, b As String, c As Integer

        <ComClass(KD_Test.ClassId, KD_Test.InterfaceId, KD_Test.EventsId)>
        Public Class KD_Test
            '"Here are the COM-GUIDs"
            Public Sub New()
                MyBase.New()
            End Sub
            Sub test()

            End Sub
        End Class
        Sub test()

        End Sub
    End Class
    Sub test()

    End Sub
End Class

公共类CHRABer
““这是COM GUID”
公共分新()
MyBase.New()
端接头
公共结构测试245
将a变暗为整数
端部结构
公共类沃尔特测试
““这是COM GUID”
公共分新()
MyBase.New()
端接头
将a调整为整数,b调整为字符串,c调整为整数
公共类KD_测试
““这是COM GUID”
公共分新()
MyBase.New()
端接头
子测试()
端接头
末级
子测试()
端接头
末级
子测试()
端接头
末级
尝试2:

<ComClass(CHRABer.ClassId, CHRABer.InterfaceId, CHRABer.EventsId)>
Public Class CHRABer
    '"Here are the COM-GUIDs"
    Public Sub New()
        MyBase.New()
    End Sub
    Public Structure Test245
        Dim a As Integer
    End Structure

    <ComClass(Volta_Test.ClassId, Volta_Test.InterfaceId, Volta_Test.EventsId)>
    Public Class Volta_Test
        '"Here are the COM-GUIDs"
        Public Sub New()
            MyBase.New()
        End Sub
        Dim a As Integer, b As String, c As Integer

        <ComClass(KD_Test.ClassId, KD_Test.InterfaceId, KD_Test.EventsId)>
        Public Class KD_Test
            '"Here are the COM-GUIDs"
            Public Sub New()
                MyBase.New()
            End Sub
            Sub test()

            End Sub
        End Class
        Sub test()

        End Sub
    End Class
    Sub test()

    End Sub
End Class

在第二次尝试中,我只是创建了没有任何COM GUID的类,等等。刚刚创建了一个公共类,然后在该类中创建了另一个。

您为这些嵌套类提供了哪些访问修饰符?您是否通过外部类(如
newnestedclass.InnerClass()
)访问嵌套类?如果你能展示一些代码,这将有助于你的问题——它们都是公共类。是的,我正在通过外部类访问它们。。。我可以展示我的一些尝试,但直到tommorow,因为所有的代码都在我的工作站上……我已经使用COM向VB6公开了嵌套的C#类,我想不出为什么它也不能在VB中工作。