Ensure that it’s made ‘COM visible’ (Project Properties -> Application Tab -> Assembly information… button -> ‘Make Assembly COM-Visible’ option checked).
- Ensure the class created is COM Visible and a COM Class (both class properties set to true – this will add an attribute to the class automatically.
Sign the assembly (Project Properties -> Signing tab -> ‘Sign the Assembly’ option checked; choose/set a key).
Select ‘Register for COM interop’. (Project Properties -> Compile tab -> ‘Register for COM interop’ option checked).
Each exportable function or sub needs to have DispID set to True and Value equal to a unique integer for the file. (.vb file -> highlight the function to export -> Properties window). ‘Exportable’ means that COM-enabled programs like MS-Access will be able to ‘see’ these functions.
- Build the assembly.
Then, to register the assembly, use regasm.exe. This is installed with the .net framework by default. Use something like the following (all on a single command line): : c:windowsmicrosoft.netframeworkv2.0.50727regasm.exe comexpress.dll /tlb:comexpress.tlb /codebase
This step becomes unnecessary because of the ‘Register for COM interop’ step above.
The assembly will be registered and available for use with any COM Compliant application, such as VB6.
Original article taken from here.
Be sure to mark your COM object’s interface as public. link