Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing arrays to .NET and getting arrays back
Message
From
02/05/2011 12:11:17
 
 
To
02/05/2011 12:02:48
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01509041
Message ID:
01509043
Views:
61
>I have built a webservice wrapper in C# for VFP to eat. Works great. All my exposed methods are receiving and returning to and from VFP as expected - except arrays
>
>I think I need a refresher on the nuances of passing arrays in and out. Because of lack of strong typing, I assume the .NET incoming param must be object[] or object[,]
>
>I am currently trying to pass in a vfp @arrparam where arrparam is dime arrayparam[4] of strings. I would like to get back ids[4,2] with strings and integers.
>
>I could also pass in a 2 dime array by reference if I could figure out how to pass it back.
>
>If my object is lows, besides
>
>comarray(lows,0) to get the array to pass in 0 based what are the other tricks I should know about this?
>
>The method works fine in my .NET test harness
>
>
>    public object[,] FindIdsByEmails(object[] emailarray)
>        {
>            int emailslen = emailarray.Length;
>            object[,] returnarray = new object[emailslen, 2];
>            for (int i = 0; i < emailslen; i++)
>            {
>                string email = (string)emailarray[i];
>                long? id = this.FindIdByEmail(email);
>                returnarray[i, 0] = email;
>                if (id != null)
>                {
>                    returnarray[i, 1] = id;
>                }
>                else
>                {
>                    returnarray[i, 1] = 00000;
>                }
>            }
>            return returnarray;
>        }
>
>
>But this VFP test prg gets me an error that "Function argument value, type or count is invalid."
>
>
>CD "c:\users\pagan\documents\visual studio 2010\projects\glwebservice\glwebservice\bin\debug"
>ACTIVATE WINDOW watch
>lows = CREATEOBJECT("glwebservice.glclient")
>lows.login("xxxxxx@xxxxx.org", "password", "<security key")
>
>DIMENSION foo(4)
>
>foo(1)="dan@primarydatasolutions.com"
>foo(2)="charleshankey@f1tech.com"
>foo(3) = "raferris@hsonline.net"
>foo(4) = "foo@foo.net"
>DIMENSION ids(4,2)
>
>comarray(lows,0)
>
>* here's where I get the error
>
>ids = lows.FindIdsByEmails(@foo)  
>
>lows.logout
>lows = null
>
>RETURN
>
>
>
>
>Suggestions, hints, pointing to docs all appreciated.


See if Message #675527 helps...
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform