I have a VB.NET assembly that I have registered for Interop. I am using a class in this assembly in my VB6 projects.
In an existing VB6 project I added a reference to the type library and run the following code:
Dim vizDataSingleton As Vizual_Data.Singleton
Set vizDataSingleton = New Vizual_Data.Singleton
The second line errors "Run-time error 430: Class does not support Automation or does not support expected interface"
However if I start a blank VB6 project and add the reference, the exact same code works fine.
I checked the reference to the tlb in the vbp file and they are both identical.
Reference=*\G{BDB20DDF-D3B7-4484-8950-35D67DED45EC}#4.2#0#..\Vizual.Data\Vizual.Data\bin\Debug\Vizual.Data.tlb#VMS Data Structure Library
I tried using late binding as well:
Set vizDataSingleton = CreateObject("Vizual.Data.Singleton")
This errors in the existing project with "Type mismatch" but again works in the new project
Any ideas why this fails in one project but works in another?
ComInterfaceType.InterfaceIsIDispatch
interface on your class (or at least, aClassInterfaceType.AutoDispatch
class interface)? msdn.microsoft.com/en-us/library/… – noseratio<ClassInterface(ClassInterfaceType.AutoDual)>
with the COM GuidsClassId
,InterfaceId
andEventsId
declared asConst
inside the class – Matt Wilko