Monday, April 30, 2007 8:00 PM
Was wondeirng could someone help with this issue.
I have c# dll that i have turned com interop on.
When registered it creates the tlb file successfully. I have a number of vb6 exe's that reference this tlb. The problem is that any time i change the c# dll and register i have to recompile all vb6 exe's. Does anyone know why this is happening?
Monday, April 30, 2007 10:01 PMAny changes you make to the C# code that changes the public interfaces of the classes you are exporting will generate a new GUID and break binary compatibility. This will mean updating the references in VB6 and rebuilding that as well. If you aren't changing the public interface the export should maintain the same GUID, but it's never guaranteed. You can force your classes to use a GUID by putting the Guid attribute with the classes in question. If you do change the public interface for your classes and don't change the Guid, expect unexpected behaviour.
Where the text is a Guid you've generated and will use for that class.
Thursday, May 03, 2007 6:25 AM
Another solution: How to use a .net dll in VB6
When we use .NET UserControl in VB6, the .NET UserControl is compiled as a COM. To expose the events of the UserControl, we need to pack the events to be exposed into an interface, which is applied the InterfaceTypeAttribute and then apply this interface to the control class. The following is a sample.Code Snippet
public interface IMyControlCOMEvents
public partial class MyControl : UserControl
Likewise, there is a Visual Basic example in the following link that shows a managed server as the event source and a COM client as the event sink. The managed server declares ButtonEvents as an event sink interface and connects the interface to the Button class. The unmanaged client creates an instance of the Button class and implements the event sink interface.
Please read the article and try the sample code: How to: Raise Events Handled by a COM Sink
Here is one referenced thread how to call dotnetUsercontrol events in vb6.0 application?