Forcing VB6 compiler to use early bind when calling .net com dll
I have a com dll written in C # After starting Regasm I can call this dll from VB6 by referencing the com dll. In VB6, I have intellisense.
However, when I press F5 to compile, the compiler shows no error when calling com dll. It should use the last binding.
How can I get it to use early binding?
Interface declared
using System.Runtime.InteropServices;
namespace combridge
{
[Guid("2f4b6041-91e3-4d9f-a9f5-9bd4adfd1789")]
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IBridge
{
// methods go here
}
}
The main class is declared
[Guid("085777fa-9397-4cfd-843a-85ececb86789")]
[ProgId("companyname.ComBridge")]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
public class BridgeImplementation : IBridge
{
#region Public Implementation
[DispId(1)]
[ComVisible(true)]
public string EchoTest(string message)
{
return string.Format("Echo '{0}' at {1:T}", message, DateTime.Now);
}
// etc
[update]
In a VB6 project, I am referencing a tlb file that I am creating using
c:\WINDOWS\Microsoft.Net\Framework\v4.0.30319/regasm /verbose /codebase /tlb:CommBridge.tlb ComBridge.dll
In VB6, I create an object using
Dim o As BridgeImplementation
Set o = New BridgeImplementation
o.EchoTest // executes
o.NonExistantFunction // run time error
+3
source to share