Using COM to call C#.NET app from another framework?
I have an old application that I am programming in. I have built a small application in C# that interacts with a database. I need call this from the old app using an object to pass back a value. I have set it up to perform this from the old app:
eg. My call from the old app
vgContact = OLEGet(vlFCObject,"GetFirmContact")
What is the easiest way to call the C#.NET app and return the value? Writing a .NET wrapper? Bearing in mind I am new to COM and .NET
A collegue tried the following but it only seems to work for his PC alone.
=============================================
using System;
using System.Runtime.InteropServices;
using Firm_Contact;
namespace FirmContactCOM
{
[Guid("D6F88E95-8A27-4ae6-B6DE-0542A0FC7039")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface _FirmContact
{
[DispId(1)]
int GetFirmContact();
}
[Guid("13FE32AD-4BF8-495f-AB4D-6C61BD463EA4")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("FirmContactCOM.FirmContact")]
public class FirmContact : _FirmContact
{
public FirmContact(){}
public int GetFirmContact()
{
return(Firm_Contact.MainFirmContact.StartUp());
}
}
}