CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009

    Type mismatch when calling a VB.NET COM class from VB6

    Hi all,

    I have to implement a COM class with VB.NET. An object of this class has then to be created from a VB6 DLL. The code for the COM dll is very simple:

    Public Class AdapterWrapper
        Implements SchemaCompInterfaces.IEFAdapter
    #Region "COM-GUIDs"
        Public Const ClassId As String = "58faad86-bbac-4b20-9ab5-fe32bdac0a68"
        Public Const InterfaceId As String = "f8dbb078-5f1e-4304-a390-3e8e88983f98"
        Public Const EventsId As String = "113d2163-f8db-4d99-88e5-58d13b8d2cf4"
    #End Region
        Public Sub New()
        End Sub
        Public WriteOnly Property CurrentSPFProjectStatus() As SchemaCompInterfaces.SPFProjectStatus Implements SchemaCompInterfaces.IEFAdapter.CurrentSPFProjectStatus
            Set(ByVal value As SchemaCompInterfaces.SPFProjectStatus)
            End Set
        End Property
        Public Function DocumentExistsInTool(ByRef oDocumentIObj As SchemaCompInterfaces.IObject) As Boolean Implements SchemaCompInterfaces.IEFAdapter.DocumentExistsInTool
        End Function
    Following many more functions from the IEFAdapter interface...
    The dll and tlb are created and registered.

    The test code for the VB6 client to use this COM class is also very simple:

    Private Sub Command1_Click()
      Dim adapter As SchemaCompInterfaces.IEFAdapter
      Set adapter = Interaction.CreateObject("MyEFAdapter.AdapterWrapper")    
    End Sub
    Now when I'm running this code, I'm getting the Run-time error '13' Type mismatch in the CreateObject line. Late binding with
    Dim adapter as Object
    seems to work for my test code, but is not a solution for me, because I can't change the proprietary VB6 code where the COM object is created. So somehow the interface "SchemaCompInterfaces.IEFAdapter" is not known... :sigh:

    Any ideas how to get close to this problem?
    In the project properties I checked the flag for registration with COM-Interop. Perhaps something to do with the ClassInterface?

    I'm relatively new to VB, so don't answer too complex...

    Thanks in advance!
    Last edited by AlexInter; July 19th, 2010 at 08:37 AM. Reason: Added [CODE] tags!

  2. #2
    Join Date
    Jul 2001
    Sunny South Africa

    Re: Type mismatch when calling a VB.NET COM class from VB6

    AlexInter, please make use of [CODE] tags when posting code, it is explained here :


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.