This is a trivial question that Im having a blonde moment over.
Been a while since I did any serious programming, Ada, Pascal, C etc etc

I have two forms created at design time. Form1 and Form2.

Form 1 has a button which when clicked should open Form 2

Could some good samaritan please post the code ....

Never used delphi before so I must be missing somthing.

Just click on one form opens other form ??

I have both forms listed as available in the project/options/form.

_ada_

// Static show
procedure TForm1.Button1Click(Sender: TObject);
begin
//  Form2.Show;
  Form2.ShowModal;
end;

// dynamic creation, show, free
procedure TForm1.Button1Click(Sender: TObject);
begin
  with TForm2.Create(self) do
  try 
     if ShowModal = mrOK then
        ShowMessage('Hello world!')
     else
        ShowMessage('Bye world!')
  finally
     Free;
  end;
end;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.