From: Meinhard Schnoor-Matriciani on

Geoff,

> Well I certainly have my answer. VO Bug and what we're doing is probably
> the best and only solution. Well thanks guys for the discussion anyhow.

before blaming VO or GrafX or who else you like to offend, you should
probably do a little bit more research on this topic.

Passing an array to a COM component written in C# is quite simple. Here's a
sample how to do it :

public class CSharpComponent
{
....
public string Concat(object list)
{
Array mylist = list as Array;
return (string) mylist.GetValue(1) + (string)
mylist.GetValue(2);
}
....
}

Inside VO the call

cSharp := _CSharpComponent{}
? cSharp:Concat( {"Lena ","rocks !"} )

will show the expected results.

Regards
Meinhard

From: Mike Pitcher on
On 1 June, 11:13, "Meinhard Schnoor-Matriciani" <meinh...(a)appfact.de>
wrote:
> Geoff,
>
> > Well I certainly have my answer. VO Bug and what we're doing is probably
> > the best and only solution. Well thanks guys for the discussion anyhow.
>
> before blaming VO or GrafX or who else you like to offend, you should
> probably do a little bit more research on this topic.
>
> Passing an array to a COM component written in C# is quite simple. Here's a
> sample how to do it :
>
>     public class CSharpComponent
>     {
>         ....
>         public string Concat(object list)
>         {
>             Array mylist = list as Array;
>             return (string) mylist.GetValue(1) + (string)
> mylist.GetValue(2);
>         }
>       ....
>      }
>
> Inside VO the call
>
>  cSharp := _CSharpComponent{}
>  ? cSharp:Concat( {"Lena ","rocks !"} )
>
> will show the expected results.
>
> Regards
> Meinhard

Meinhard ... Enjoyed your example. But I must point out that it takes
real skill to come last in the Eurovision Song Competition.

All the best

Mike P
From: Geoff Schaller on
Meinhard.

Thanks for the advice - I guess this requires specific data types in C#.
At least in this instance we can change things to try this - which I
will do today.

We used string[] in C# which as I say, comes to VO as an array of
strings but won't go back. I will convert these items to lists to see
what what happens.

Geoff


"Meinhard Schnoor-Matriciani" <meinhard(a)appfact.de> wrote in message
news:4c04ddbc$1(a)news.arcor-ip.de:

> Geoff,
>
>
> > Well I certainly have my answer. VO Bug and what we're doing is probably
> > the best and only solution. Well thanks guys for the discussion anyhow.
>
>
> before blaming VO or GrafX or who else you like to offend, you should
> probably do a little bit more research on this topic.
>
> Passing an array to a COM component written in C# is quite simple. Here's a
> sample how to do it :
>
> public class CSharpComponent
> {
> ....
> public string Concat(object list)
> {
> Array mylist = list as Array;
> return (string) mylist.GetValue(1) + (string)
> mylist.GetValue(2);
> }
> ....
> }
>
> Inside VO the call
>
> cSharp := _CSharpComponent{}
> ? cSharp:Concat( {"Lena ","rocks !"} )
>
> will show the expected results.
>
> Regards
> Meinhard

From: Geoff Schaller on
Meinhard and others.

I can report that this is an acceptable workaround for the OLE bug.

Now in the generated prototype the variable is identified as 'Usual'
instead of 'Array of String' and of course the C# code must type qualify
the parameter and its contents but at least this will work and means I
don't have to create serialised arrays as strings. It's kind of a shame
because string[] works the other way correctly (sending to VO). C#
treats the item as an array of objects only. I tried to see if I could
extract a string directly from the array but it won't take it.

I'd make the further remark that the docs should now be updated to
reflect this but finding the docs in the first place might be an issue
<g>. I did try an Array parameter (in C#) but that didn't work so the
un-typed object is required.

Thanks for the help.

Geoff

PS - I will publish a new version of my Active Directory component soon
that takes advantage of this.


"Meinhard Schnoor-Matriciani" <meinhard(a)appfact.de> wrote in message
news:4c04ddbc$1(a)news.arcor-ip.de:

> Geoff,
>
>
> > Well I certainly have my answer. VO Bug and what we're doing is probably
> > the best and only solution. Well thanks guys for the discussion anyhow.
>
>
> before blaming VO or GrafX or who else you like to offend, you should
> probably do a little bit more research on this topic.
>
> Passing an array to a COM component written in C# is quite simple. Here's a
> sample how to do it :
>
> public class CSharpComponent
> {
> ....
> public string Concat(object list)
> {
> Array mylist = list as Array;
> return (string) mylist.GetValue(1) + (string)
> mylist.GetValue(2);
> }
> ....
> }
>
> Inside VO the call
>
> cSharp := _CSharpComponent{}
> ? cSharp:Concat( {"Lena ","rocks !"} )
>
> will show the expected results.
>
> Regards
> Meinhard

First  |  Prev  | 
Pages: 1 2 3
Prev: secrets of money earning
Next: is that 5333 safe ?