>If I use the technique described in your faq, thus :
>
>
>thisform.addobject( "thisform.alabels(3)", "MyObject" )
>thisform.removeobject( "thisform.alabels(3)" )
>
>
>then the object does not disappear from the screen & the Destroy method is not called. thisform.alabels(3) is set to .F.
>
>I'm guessing the object is not correctly destroyed, giving the possibility of a 'memory leak'. Do you know how I should correctly remove the objects added into the array.
I don't know - I never found the need to eliminate the objects before destroying the form. I will investigate this eventually.
In the meantime, perhaps you can try this yourself: what happens when you set ThisForm.aLabels(3) = .NULL.?
And perhaps my method creates a memory leak which I wasn't aware of.
Perhaps, because of the use of undocumented features, we are getting into trouble here. So perhaps you have to revert to the other alternative, as suggested by Armin - at least, when you want to release objects without releasing the form.
HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)