G
Guest
I am trying to create and use a COM object with C#.NET 2005.
The assembly is set to "Register for COM interop" but when I am trying to
call it from VB on Word 2003 I am getting this error:
Run-time error '-2147024894 (80070002)':
File or assembly name COMTest3, or one of its dependencies, was not found.
The code for the COM:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace COMTest3
{
[Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")]
public interface ComNameITInterface
{
[DispId(1)]
string GetMyName();
}
[Guid("7BD20046-DF8C-44A6-8F6B-687FAA26FA71"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ComNameITEvents
{
}
[Guid("0D53A3E8-E51A-49C7-944E-E72A2064F938"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(ComNameITEvents))]
public class NameIT : ComNameITInterface
{
public string GetMyName()
{
return "ABCDEF";
}
}
}
The code for the VB to call the COM:
Private Sub Document_New()
Dim x As New COMTest3.NameIT
MsgBox x.GetMyName()
Set x = Nothing
End Sub
Thanks for any help,
Asaf
The assembly is set to "Register for COM interop" but when I am trying to
call it from VB on Word 2003 I am getting this error:
Run-time error '-2147024894 (80070002)':
File or assembly name COMTest3, or one of its dependencies, was not found.
The code for the COM:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace COMTest3
{
[Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")]
public interface ComNameITInterface
{
[DispId(1)]
string GetMyName();
}
[Guid("7BD20046-DF8C-44A6-8F6B-687FAA26FA71"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ComNameITEvents
{
}
[Guid("0D53A3E8-E51A-49C7-944E-E72A2064F938"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(ComNameITEvents))]
public class NameIT : ComNameITInterface
{
public string GetMyName()
{
return "ABCDEF";
}
}
}
The code for the VB to call the COM:
Private Sub Document_New()
Dim x As New COMTest3.NameIT
MsgBox x.GetMyName()
Set x = Nothing
End Sub
Thanks for any help,
Asaf