Hello,
"* create locals to explicitly set the type of SalesItem properties
local lngCid as Long, lngQty as Long, lngSession as Long, dblAmount as Double, bolUpSess as Boolean, lngUpSellStaffId as Long, bolCrystalBall as Boolean"
you don't need to do this, setting the properties on the object directly should work just fine, VFP doesn't respect the types you specified in the AS clause anyway.
The are only 2 situations where the AS clause is useful.
1. When you write your own COM object in VFP, the AS clause specifies the type that is written to the type library, and therefore is seen by other programming languages.
2. If you declare a variable as a COM object of some specific type, VFP is able to early bind to it instead of using late binding, giving you a performance gain
"* setup additional paramters that are passed to Sell() method
local lngReceiptNumber as Long, lngDeviceType as Long, ;
lngHighestSold as Long, strCustId as String, ;
bytSellingSession as Byte, intUnitNumber as Integer"
same as above, you can pass the values directly.
there are still some rare bugs in VFP when calling method's on COM objects.
Most of the time you can overcome these by calling the method on an intermediate "interface object".
e.g. try this:
loInterface = GETINTERFACE(loMyObj,'ITheInterfaceThatImplementsYourMethod')
intUnitNumber = 0
lnResult = loInterface.Sell(@laItems,1,0,6,"",1,@intUnitNumber)
? "Result:" + str(lnResult)
? "Unit:" + str(intUnitNumber)
"What am I doing wrong??"
Nothing, VFP is just buggy.
Regards
Christian