>Hi all
>
>I have a grid class and in it's Init() I ADDOBJECT() THISFORM and THIS.PARENT one each. When I put in the THISFORM.oCustom = .NULL. and THIS.PARENT.oCustom = .NULL. for cleaning up my doings, it seems that the objects are already destroyed by the form and parent classes, fair deal.
>
>But is this the way it should have been handled? Or is there a better OOPian way to do ADDOBJECTS() onto the formand parent classes?
>
>Please advise.
Bhavbhuti,
You're not creating external object references but directly adding objects. So let the form destroy them all:) ie:
public oForm
oForm = createobject('myForm')
oForm.Addobject('myLabel2','Label')
with oForm.myLabel2
.Caption = "Hello 2"
.Top = 30
.Visible = .t.
endwith
oForm.Show
define class myForm as form
add object myLabel as Label with caption='Hello'
enddefine
No need to try to set thisform.myLabel2 = .null.
Cetin