-
July 19th, 2010, 07:12 AM
#1
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:
Code:
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()
MyBase.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:
Code:
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
Code:
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!
Alex
Last edited by AlexInter; July 19th, 2010 at 08:37 AM.
Reason: Added [CODE] tags!
-
July 19th, 2010, 08:15 AM
#2
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 :
http://www.codeguru.com/forum/showthread.php?t=403073
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|