views:

37

answers:

2

Just another of those things that I have never done before but which is probably simple ... when you know how

I am using VB Express 2008 and need to create a very simple DLL.

I already built and tested it and now I find that it has to be a COM DLL. How do I go about that?


Edit: in reply to @Kman - I looked at http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comvisibleattribute.aspx

and changed my code to

Imports System.Runtime.InteropServices

Namespace My_DLL

  <ClassInterface(ClassInterfaceType.AutoDual)> _
  Public Class My_DLL

      <ComVisible(True)> Public Sub Function_A()
      End Sub

      <ComVisible(True)> Public Sub Function_B()
      End Sub
  End Class
End Namespace

but I still don't the functions using DLL Explorer, whereas I do see them in the old DLL ...

+2  A: 

Check http://www.codeproject.com/KB/COM/nettocom.aspx

Maybe http://www.exforsys.com/tutorials/vb.net-2005/creating-and-managing-components-in-vb.net-2005-section-1.html

The MS pages about it are here: http://msdn.microsoft.com/en-us/library/3x7357ez%28vs.71%29.aspx

Follow the suggestions and if you want to learn more check out the following book .NET and Com the Complete Interoperability Guide. Everything is explained there in whatever detail you like.

Friedrich
Mawg
Please see updated question ...
Mawg
+1  A: 

Qualify your dll for interop; mark its ComVisibleAttribute to true.

Right click your project, goto Build tab, and check the last Checkbox, which says "register for COM interop".

KMan
+1 Thanks for replying. I don't see "register for COM interop" in VB Express 2008 ... but in Project/Properties/Application/Assembly Information I do see Make assembly COM-visible ... that seems to make no difference
Mawg
Please see updated question ...
Mawg
Please see **Walkthrough: Creating COM Objects with Visual Basic .NET** http://msdn.microsoft.com/en-us/library/x66s8zcd(VS.71).aspx
KMan