>>>In a VFP form all control object references are held in the Controls() array. I want to build an array that contains references for selected controls on my form. My goal is to be able to clear the ControlSource for selected text box controls and then set them to a saved value later. I can clear them with SetAll(). What I need is an easy way to restore them. I would like to be able to say ThisForm.Controls[nPtr].ControlSource = ThisForm.Controls[nPtr].SavedControl. The problem with that is that my form has multiple pages and it gets messy. I want to create my own array with a hand full of text box controls in it.
>>>
>>>My question is how do I store the object's reference into an array?
>>>
>>>Thanks!
>>
>>
>>Look at createobject(). Use a public array instead on just a memvar. Better yet use an array set as an objects property.
>>
>>Tom
>
>
>I was planning on creating the array as a form property. I guess I was a little unclear in my explanation. The text box objects already exist on the form. I want to store references to them in the array so that I can easily get back to them later. I really want to say "aArray[nPtr] = THIS". I know I can't do that though. Then later I could say aArray[nPtr].
= .
Yes, you can do exactly what you've proposed. Just make sure you add "thisform." to the front of "aArray[nPtr]" if the array is a property of the form.
Paul