Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing arrays to .NET and getting arrays back
Message
De
02/05/2011 14:47:58
 
 
À
02/05/2011 13:04:23
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01509041
Message ID:
01509080
Vues:
53
SNIP

(Sorry for the sloppy code, but I think you get the picture. Try referencing your array like so to see if it is really there or not...)

Can you just return an object? This works for me:
See section: "Passing Complex types between Visual FoxPro and .NET:"
http://www.west-wind.com/presentations/dotnetfromVfp/DotNetFromVfp_ComplexObjects.asp

Another option, when I get a collection hanging on an object from .net (passed to VFP via an event firing), I have to reference it like so or else I cannot "see" it:
*--Event that is hooked up and fires:
PROCEDURE INETAPIEvents_QuestAnsEvent(arg AS VARIANT) AS VOID
*arg object is passed to vfp via com interop event firing  - it has collections as properties (remember it is zero-based in .net)
*VFP Code in event to see questions and answers collection passed from .net:
*arg object is passed to vfp via com interop event firing  - it has collections as properties (remember it is zero-based in .net)
*VFP Code in event to see questions and answers collection passed from .net:
IF TYPE("arg") = "O"  AND ...  && etc skip the stupid stuff you know
   IF TYPE("arg.myObject") = "O" AND TYPE("arg.myObject.myCollection") = "O" AND TYPE("arg.myObject.myCollection.count") = "N" AND arg.myObject.myCollection.COUNT > 0
	FOR I = 0 TO arg.myObject.myCollection.COUNT-1
		IF TYPE("arg.myObject.myCollection.ITEM[m.i].Questions") = "O" AND arg.myObject.myCollection.ITEM[m.i].Questions.COUNT > 0  && Are there questions and answers?
			FOR iq = 0 TO arg.myObject.myCollection.ITEM[m.i].Questions.COUNT - 1
				RELEASE loTemp
				loTemp = arg.myObject.myCollection.ITEM[m.i].Questions.ITEM[m.iq]
				IF TYPE('ALEN(loTemp.Answers,1)') = "N"
					FOR ia = 1 TO ALEN(loTemp.Answers,1)
						IF .F.
							DIMENSION laAnswers[1]
						ENDIF
						RELEASE laAnswers
						laAnswers = loTemp.Answers
					ENDFOR
				ENDIF
.·*´¨)
.·`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"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform