To flag a class library as being a COM library, follow these steps:
1. Right click on the project in the solution explorer, and click "Properties"
2. Click the "Configuration Properties" node in the tree at the side, and under that,
click the "Build" item.
3. Check the "Register for COM Interop" checkbox
4. Click OK
<ComClass(SimpleMath.classGuid, SimpleMath.interfaceGuid, SimpleMath.eventGuid)> _
Public Class SimpleMath
These GUIDs were generated using the "guidgen.exe" tool, found at this location:
C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\guidgen.exe
Public Const classGuid As String = "D0637236-F915-447a-9347-E11770C07466"
Public Const eventGuid As String = "09725A16-9195-4d8c-A4B4-D5404A3A4CC7"
Public Const interfaceGuid As String = "C1D08CEA-2286-4285-ABF4-3C1E642F7C33"
Public Function Add(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Return num1 + num2
End Function
Public Function Subtract(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Return num1 - num2
End Function
Public Function Multiply(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Return num1 * num2
End Function
Public Function Divide(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Return num1 \ num2
End Function
Every COM class must have a parameterless constructor to register properly
Public Sub New()
MyBase.New()
End Sub
End Class