Board index » delphi » closing all forms in a project except main-form

closing all forms in a project except main-form

Hi, I have a project with many forms,
is there a easily coded way to close all forms except the main-form?

Thanks, Bhas

 

Re:closing all forms in a project except main-form


procedure TForm1.Button2Click(Sender: TObject);
var
  i: integer;
begin
  for i := Screen.FormCount - 1 downto 1 do
  Screen.Forms[i].Close;
end;

Charles Johnson

Other Threads