What error do you get when calling Set o = CreateObject(....)
What attributes did you set on your methods, remember vbscript can only call
methods on objects implementing IDispatch (and dual) interfaces.
Here's a small sample that illustrates the attribute usage...
using System.Runtime.InteropServices;
using System;
// interface definition, dual to be script friendly
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[Guid("D3DF5658-3D3F-436b-B6A6-F10E77AE3F5F")] // Use guidgen to obtain
valid GUID's
public interface IDotNetInterface
{
int someMethod();
}
// class
[ClassInterface(ClassInterfaceType.None)]
[ProgId("Test.DotNetInterface")] // progid
public class DotNetInterface : IDotNetInterface
{
public int someMethod()
{
// Implemetation of someMethod, returning an int
return 0;
}
}
Check MSDN for details on InterfaceType and ClassInterface attributes.
The VBScript Client...
Set o = CreateObject("Test.DotNetInterface")
Dim var, ret
ret = o.someMethod()
WScript.Echo ret
Willy.
"C# beginner" <an*******@discussions.microsoft.com> wrote in message
news:52****************************@phx.gbl...
Thanks Willy. As I mentioned in my previous posting, I
have registered my C# component using regasm and generated
a tlb file. Per your suggestion, I tried using
the /codebase option also. still doesn't work. Any help is
appreciated.-----Original Message-----
Placing your assembly in the GAC won't help a COM client
to find theassembly, COM has no idea what the GAC is.
What you should do instead is to register your assembly
using the Codebaseoption of regasm.
Willy.
"C# beginner" <an*******@discussions.microsoft.com> wrote
in messagenews:4c****************************@phx.gbl... Hi all
I am trying to call my C# class library from COM. My C#
library works perfectly in the .NET environment. I have
registered my C# component using regasm and also placed it in the GAC. But for some reason my VBScript COM component can't interop with .NET. I am calling my .NET component as follows.
Set GSF = CreateObject("CSAppName.ClassName")
Can you please tell me what I am missing? Thanks a lot for your help.
.