How can I display a form for set configuration before the main form?

Posted by Hamidm on Stack Overflow See other posts from Stack Overflow or by Hamidm
Published on 2011-01-07T20:22:31Z Indexed on 2011/01/07 20:54 UTC
Read the original article Hit count: 148

Filed under:
|

hello,

in my project i have two form's(form1,form2), form1 is configuration form.

i want to show Form1 and when we click Button1 then show Form2 and free(Release) Form1. how can to i do this?

i use this code. but this project start and then exit automatically.A Friend said because the application message loop never start, and application terminates because main form does not exist. how i can to solve this problem?

uses Unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Application.CreateForm(TForm2, Form2);
  Release;
end;

///

program Project1;
uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Form1:= TForm1.Create(Application);
  Application.Run;
end.

© Stack Overflow or respective owner

Related posts about delphi

Related posts about delphi-xe