tags:

views:

30

answers:

2

In VB6, when referencing a .NET component, why can't I reference the DLL? Why do I have to reference the .TLB file?

+3  A: 

VB6 has no mechanism that allows it to call managed code directly (i.e. the .Net component). The .TLB file contains the compiled header information that VB6 "understands", and in turn allows it to call the .Net assembly.

Darksider
A: 

No, you'd reference your .NET assembly's DLL. But first you you have to register the assembly for COM interop. There are a couple ways to do this and they're described in this MSDN article:

How to call a Visual Basic .NET or Visual Basic 2005 assembly from Visual Basic 6.0

Jay Riggs
@Jay: the VB6 compiler seems to prevent directly referencing a .NET dll even if it is registered.
Craig Johnston