Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Don't know how to process collection returned by com object
Message
De
09/07/2004 15:14:57
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Don't know how to process collection returned by com object
Divers
Thread ID:
00922659
Message ID:
00922659
Vues:
70
I am writing a vfp7 app. I am using a component called atfincalc. I don't have a lot of experience with collections. The developer has sample vb code that I am trying to get to work in VFP. One of the methods returns a collection:

Using a for each loop seems to work right,I can access the flow object. But it doesn't work to reference the flow object via the flows element number.

Are these problems due to: a) syntax errors on my part b)vfp doesn't support collections in the same way vb does

I haven't tried this in vfp8 - have heard it has better support for collections - but have heard there are problems with it.
oLoan = CreateObject("AtFinCalc.Loan")
oFlowItem=CreateObject("AtfinCalc.CashFlow")
oFlows=CreateObject("AtfinCalc.CashFlows")

orig = 100000
oloan.Amount = orig
oloan.Periods = 15 * 12
oloan.Rate = .0725 / 12
payment = oloan.CalcPayment()
?payment
flows=oloan.CalcCashFlows()

*-- works in vfp - but debugger doesn't recognize flows and flow
*-- in the same way that it does oFlows and oFlowItem
*-- amembers doesn't work on this object
for each flow in flows
	  *' Do processing
      	  interest = flow.Interest  &&' Interest Paid
	  ?interest
	  payment = flow.Payment    &&' Payment Amount
          principle = flow.principle
	  ?payment
next flow


*-- doesn't work in vfp - took this code from their vb example and revised
for i = 0 to flows.Count - 1
	
        balance = flows(i).Balance  && get error flows is not an array
 	ocurrent=flows(i)  && error 'flows.prg does not exist
 	?ocurrent.balance
  next i
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform