July 19th, 2010, 07:12 AM
Type mismatch when calling a VB.NET COM class from VB6
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:
Following many more functions from the IEFAdapter interface...
Public Class AdapterWrapper
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"
Public Sub New()
Public WriteOnly Property CurrentSPFProjectStatus() As SchemaCompInterfaces.SPFProjectStatus Implements SchemaCompInterfaces.IEFAdapter.CurrentSPFProjectStatus
Set(ByVal value As SchemaCompInterfaces.SPFProjectStatus)
Public Function DocumentExistsInTool(ByRef oDocumentIObj As SchemaCompInterfaces.IObject) As Boolean Implements SchemaCompInterfaces.IEFAdapter.DocumentExistsInTool
The dll and tlb are created and registered.
The test code for the VB6 client to use this COM class is also very simple:
Now when I'm running this code, I'm getting the Run-time error '13' Type mismatch in the CreateObject line. Late binding with
Private Sub Command1_Click()
Dim adapter As SchemaCompInterfaces.IEFAdapter
Set adapter = Interaction.CreateObject("MyEFAdapter.AdapterWrapper")
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:
Dim adapter as Object
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!
July 19th, 2010, 08:15 AM
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
Click Here to Expand Forum to Full Width