COM Assembly & Interface Inheritance...

BrianP

New member
Joined
Oct 9, 2009
Messages
1
Programming Experience
1-3
Hey all...I've become a member since I can't for the life of me find the answer to this problem online. Hopefully someone can help me out here.

I'm developing a .NET assembly and using COM Interop. The goal is to use this assembly in a VB6 report generating app. First let me start with a sample of how the code looks (obviously simplified).

VB.NET:
<InterfaceType(ComInterfaceType.InterfaceIsDual)> _
Public Interface IReportBase
   <DispId(1)> _
   ReadOnly Property Path() As String
End Interface

<InterfaceType(ComInterfaceType.InterfaceIsDual)> _
Public Interface IReport
   Inherits IReportBase

   <DispId(1)> _
   Function GenerateReport() As Integer
End Interface

Public Class ReportBase
   Implements IReportBase

   Public Readonly Property Path() As String Implements IReportBase.Path
End Class

Public Class SpecificReport
   Inherits ReportBase
   Implements IReport

   Public Function GenerateReport() As Integer Implements IReport.GenerateReport
End Class

I build the assembly, use regasm AssemblyName.dll /tlb:AssemblyName.tlb, then reference the AssemblyName.tlb in the VB6 app. The problem I'm seeing is that when I do this code (in the VB6 app):

VB.NET:
Dim test as AssemblyName.SpecificReport

I expect to see the intellisense pick up on test.GenerateReport AND test.Path. I only see test.GenerateReport. I looked into the type library file with OLE View and when I expand "Interface IReport" then expand "Inherited Interfaces" I only see "IUnknown". Shouldn't "IReportBase" show up as well? When I expand "coclass SpecificReport" I see both IReportBase and "IReport". I'm not terribly familiar with what goes on in the type library, but I suspect somewhere along the way the interface inheritance isn't being picked up when the type library is created. I would really like to use early binding with this app and get the intellisense along with that, but I can't figure this out. Anyone have any clues?
 
Back
Top