>Thanks Sergey. I just want to add to anyone who is reading this later, for example, that the empty class doesn't have the addproperty method. that threw me for a bit until i looked it up in the "what's new in vfp8.0" book. you have to use the addproperty function.
>
>One thing I've noticed here, which i touched on in my message to cetin, is that this seems to be a lot more work to pass variables when all i would have to do is list them as public. in your opinion, why would this be worth it? what makes this better? the method in my example was listed as the "best" method (from kilofox) for returning multiple values from a function. now i think kilofox was dealing with vfp6.0. can vfp8 return multiple values from a function without having to go through this?
>
>thanks,
>
>Paul
Paul,
A function can only return one single variable and can take 27 parameters at max. However since an object is a single variable (which can hold virtually unlimited parameters as its properties or property arrays) it's the ultimate multiple parameter passing and retrieving way (and along the lines a form is an object - you may pass or return its reference at least in theory).
Public varaibles at first sounds to be less work but if you look at closely they're more work to provide an application work w/o 'hard to catch' bugs. As Hilmar pointed a form is a nice example for that.
Consider you have a form which you pass a customerID and do various things within that form for that particular customer. VFP has the ability to run multiple instances of a form and you might utilize this fact:
-You're working with CustomerA's account
-CustomerB calls and wants you to check his account
You leave the first form open and simply "do form myCustomerForm wih CustomerB_Id"
Now think what if you have used some public variables within this form or this form relied on external public varaibles to do its work. In first form you may have set a public variable to a specific value for customerA, went and opened new form for customerB, in new form you 'touch' that variable, on return to formA you now have the new value in that variable for CustomerB.
Hard to express all these in plain English:)
Cetin