Sometimes the form was free, but it is not zero. In this case, the Assigned check is not so good. So one option is to free the form and set MyForm: = nil on the OnClose form. another option is to use the following procedure:
function TMyForm.IsFormCreated: bool;
var i: Integer;
begin
Result := False;
for i := 0 to Screen.FormCount - 1 do
begin
if Screen.Forms[i] is TMyForm then
begin
Result := True;
Break;
end;
end;
end;
source
share