0

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_

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Wolfgan
0
// 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;

Edited by Wolfgan: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.