Accessing COM from Visual Basic .NET

When you are writing managed code in Visual Basic .NET, you cannot program directly against a COM type definition within a type library such as a coclass or interface. Instead, you must first create or acquire a special shim DLL called an interop assembly. An interop assembly contains COM type definitions that have been translated into managed types. It provides a gateway into a COM DLL because it contains a set of managed types that allow you to indirectly program against the types defined within the DLL's type library.

Figure 12.4 shows how the various pieces fit together. An interop assembly named Interop.PetsLibrary.dll has been generated to provide access to the COM types inside PetsLibrary.dll. It contains ...

Get Building Applications and Components with Visual Basic .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.