1) Nothing wrong with the code! 2) However, it is not a suitable way to close the application, as many other factors must be taken into account, for example, if there is some other task that must be performed first, etc...
--- Form1----- var Form1: TForm1;
implementation
{$R *.dfm}
uses Unit2;
procedure TForm1.Button1Click(Sender: TObject); begin Application.CreateForm(TForm2, Form2); Form2.Show; end;
procedure TForm1.Button2Click(Sender: TObject); begin close; end;
initialization
ReportMemoryLeaksOnShutdown := true;
end. ----------
---- Form2 ---- var Form2: TForm2;
implementation
{$R *.dfm}
uses Unit1;
procedure TForm2.Button1Click(Sender: TObject); begin Form1.Close; end;
end.
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3