And as a hint, try not to use the destructor Destroy
directly.
The documentation suggests using Free because it
checks whether the object for which you are calling
Free is Nil or not. If it is Nil, it will not call
Destroy.
For example, if you have the following:
procedure Test();
var
myObj: TObject;
begin
myObj := Nil;
myObj.Free();
end;
This code will not raise any error because Free
automatically checks to see if myObj is Nil. If it is
not Nil, it will call Destroy successfully.
But if you replace Free() with Destroy(), you will get
an access violation because Destroy.
If you would like to read some details on this
subject,
search for static and virtual methods and
virtual-method tables (VMT).
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ