I have an application that has 4 forms.
After the process there is a button for the person to start again.
procedure TForm4.Button3Click(Sender: TObject);
begin
FreeAndNil(Form1);
FreeAndNil(Form2);
FreeAndNil(Form3);
FreeAndNil(Form4); //Libera o form da memória
Application.CreateForm(Tform1, form1);
Application.CreateForm(Tform2, form2);
Application.CreateForm(Tform3, form3);
Application.CreateForm(Tform4, form4);
Application.Run; //Roda a aplicação
end;
Until then, but if she presses the close button.
Displaysthefollowingmessage:
It crashes, the windows message appears to close the program, and only then does it close.
obs: (The error only appears if the person clicks the button to start the process again, if it opens the program for the first time, it works correctly.)
I think you have a problem releasing the forms, where can I be wrong?
My intention is that when I click on button3
there would be a reset
on form, and the user would start from scratch.