Exposing .NET Objects to the COM World
Although in modern world applications this practice occurs less frequently than in the past, you can expose .NET objects to the COM world. For example, a VB 6 application can consume an object like this. To demonstrate how you accomplish this export, create a new class library and rename Class1.vb to Contact.vb. The first thing you need to do to enable a class to be called from COM is provide COM interoperability support. Now open My Project and select the Compile tab. Flag the Register for COM Interop item at the bottom of the page, as shown in Figure 46.3.
Get Visual Basic 2015 Unleashed 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.