How to tell if a form has been created (or any object)?

Abstract: Set object references to nil.

Question:

How to determine if a form has been created (or any object)?


Answer:

If you creating and freeing an object several times, and you need to be able to tell if the object is currenly created or freed, set the object's reference to nil everytime you free it. For example:
MyObject.Free;
MyObject := nil;

Or in Delphi 5 or higher:
FreeAndNil(MyObject);
Then you can simply use the Assigned function to test if the object is nil or not.


Server Response from: ETNASC02