Displaying an Auto-created Form

From RAD Studio
Jump to: navigation, search

Go Up to Controlling When Forms Reside in Memory


If you choose to create a form at startup, and do not want it displayed until sometime later during program execution, the form's event handler uses the ShowModal method to display the form that is already loaded in memory:

procedure TMainForm.Button1Click(Sender: TObject);
begin
  ResultsForm.ShowModal;
end;
void __fastcall TMainMForm::FirstButtonClick(TObject *Sender)
{
    ResultsForm->ShowModal();
}

In this case, since the form is already in memory, there is no need to create another instance or destroy that instance.

See Also