Sorry I didn't check back your code and just sampled it with a value.
Your code was like this :
replace system_price with thisform.price(order_guide.item_num)
^^^^ this is the line that causes the error. I eve tried:
real_price=thisform.price(order_guide.item_num)
With the GetPrice method (assuming its code is what you want):
replace system_price with thisform.GetPrice(order_guide.item_num)
real_price=thisform.GetPrice(order_guide.item_num)
Yes thisform.GetPrice(somevalue) is returning the value calculated by GetPrice just like in old days :
replace system_price with GetPrice(order_guide.item_num)
real_price=GetPrice(order_guide.item_num)
function GetPrice
parameters ....
* Code....
return SomeValueBack
Difference is that now procedure is a method of form and therefore preceded by 'thisform.'
Properties are like old variables and arrays. m.mYvar was denoting a memory variable. Still it does. Now any object can store a 'variable' named 'property'. An object has a name - say myTextbox. myTextBox object could store many variables, buit-in ones like BackColor, Value or added ones. Here m. is replaced by object's name :
myTextBox.Price
myTextbox.myVar
myTextBox.Backcolor
and so on. In old days actually we were dividing this to multiple m. :
m.Price
m.myVar
m.Backcolor
as if m. was an object.
Each object is encapsulated. That's many object's could have the exact same propertyname.
myTextbox1.value = 'Hello'
myTextBox2.Value = 'There'
Thisform and this are reserved shortcut object identifiers.
GetPrice() method could be defined in many form objects or custom objects each doing a different kind of calculation. In old days we were keeping them with either different names or in different procedure files. Now it belongs to an object (here it was thisform) instead of a separate procedure file.
Getting longer I think it's getting messy :)
Cetin
>In your code below how is it passing over the item_number? thisform.ItemNo in the click command is the Item number I am passing to the GETPRICE method? But it for the replace command thisform.getprice is returning the value calculated by GetPrice? I assume that (thisform.ItemNo) is passing the item# to the getprice mathod and does not contain the returned value?
>
>I did not intend to return an array, I just need to return a single price xxxx.xx so I could simple say in my method return_price=xxx+yyy etc?
>
>David
>
>
>
>--------your code------------------------
>* Form.GetPrice 'method'
>lparameters tnItemNumber
>external array arrPrice
>select price from products where ItemId = tnItemNumber into array arrPrice
>return iif(_Tally=0,0,arrPrice)
>
>* Commandbutton.click
>replace myfield with thisform.GetPrice(thisform.ItemNo)