Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to build a COM Component in C# that can be referenced and used from VB5/6
    primarykey
    data
    text
    <p>I am trying to see if I can build a COM component in C# (.NET 4) which I can use from a VB5 program (cue derisive remarks) to access a web service. Following all the instructions I have been able to find on MSDN and CodeProject as follows: </p> <ul> <li><a href="http://www.codeproject.com/KB/COM/com_object_in_c_.aspx" rel="nofollow">Building COM Objects in C#</a></li> <li><a href="http://msdn.microsoft.com/en-us/library/c3fd4a20.aspx" rel="nofollow">Example COM Class (C# Programming Guide)</a></li> </ul> <p>I have written the following:</p> <pre><code>[Guid("7A715F02-D349-45DC-B0AE-9925FD3B943C")] public interface ARCOM_Interface { [DispId(1)] string GetServiceResponse(); } [Guid("5130F041-619E-41F9-84B6-8332642228F6") , InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface ARCOM_Events { } [Guid("0A77754F-34CF-4E0E-AAC2-85FD686758E0") , ClassInterface(ClassInterfaceType.None) , ComSourceInterfaces(typeof(ARCOM_Events))] [ComVisible(true)] public class ARCOM_Class : ARCOM_Interface { public string GetServiceResponse() { string response = string.Empty; ARWebService.ARWebService svc = new ARWebService.ARWebService(); response = svc.PingMeBack(); return response; } } </code></pre> <p>The Assembly in question is signed with a strong name and the output is registered for COM Interop. After building, I have applied RegAsm to it and generated a type library with tlbexp.exe. </p> <p>In VB6, when I open the list of references from the Project properties, I can find the assembly in the list, and I can check it. I can even do the following in the VB6 code:</p> <pre><code>Private Sub HitWebService() Dim arcom As ARCOMObject.ARCOM_Class arcom. &lt;== Intellisense doesn't sense anything! End Sub </code></pre> <p>The Intellisense sees the ARCOMObject and the class, but nothing that is within the ARCOM_Class itself (except for the usual "GetType", "Equals" and other generic Object methods/properties). Most specifically, it does not seem to see the GetServiceResponse() method, so I can't call it.</p> <p>What am I leaving out?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload