Using .NET Components in COM Applications

As you saw, using COM components in a .NET application was an easy task. Now, it's time to look at the reverse situation, in which you will call a .NET component from a COM application. This situation is not quite as clean as using COM components in .NET because you have to perform some tricks to get it to work.

Preparing the .NET Component for COM Clients

The first thing you want to do to have a .NET component that can be called by a COM client is to create your .NET component as you normally do. Start a new Class Library named NetInterop. Inside Class1.vb, you'll change the class name to EmpNet and enter the code that gives you the same functionality as the COM component from earlier. Your final code ...

Get A Programmer's Introduction to 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.