Hi,
I need to write a ComVisible object in C# and there are some methods
that must return a multidimensional array of strings. I created a .NET
assembly, marked it COM visible, created a TLD via regasm and added
it to the GAC. I can now create instances and execute code, but I'm
not able to use the results that in the multidimensional array. I've
tries several version, but I can't get it to work.
Can someone help? I keep getting Type mismatch errors. A lot of this
is written on the Internet, but nothing seems to work.
//Version1
public string[][] ClientManagementQuery(bool CW_OPERATIONAL)
{
....
return ConvertDataToArray(orderedView); //
ConvertDataToArray returns string[][]
}
//Version2
public object[,] ClientManagementQuery(bool CW_OPERATIONAL)
{
...
return (object[,])ConvertDataToArray(orderedView);
}
//Version3
public object ClientManagementQuery(bool CW_OPERATIONAL)
{
...
return (object)(object[,])ConvertDataToArray(orderedView);
}
Here's the VBScript
Dim foo
Set foo = CreateObject("Genco2pi.Logic.Genco2piLogic")
dim results(1000,1000)
results = foo.ClientManagementQuery(true)
MsgBox results(1,1)
Thanks in advance,
Marc
Marc Vangrieken - 20 Nov 2007 08:47 GMT
> Hi,
>
[quoted text clipped - 40 lines]
> Thanks in advance,
> Marc
Ok, for some reason version 3 is working now. I think I was mixing
different versions of DLL's, only re-registering some of them.