Hi, i apologize if this is in the wrong section (First Post);

i am fairly new to delphi / pascal but was wondering how to create a form within a form, e.g. click a button on Form1 to open Form2, i am aware that tform.create is a function but am not sure how to use it,
i would appreciate an answer :)
thankyou!

sfp,
there is more than one way ....
1. When Form2 is an autocreate Form ( Delphi Application automatically creates the Form at the start ot the Application ) :
In this case it is enough to Show the Form2, without create it, because it is already created:
1.1.

Form2.Show;

1.2.

Form2.ShowModal;

2. When Form2 is not an autocreate Form :
In this case firs you have to Create the Form, Show it and Destroy it after it's usage:

Application.CreateForm(TForm2, Form2);
  try
    Form2.ShowModal;
  finally
    Form2.Free;
  end;

There is a third way when the Application is Multi Document Interface: Property of the Form1 FormStyle is set as fsMDIForm, and property of the Form2 FormStyle is set as fsMDIChild, so Form2 will appears really inside the Form1

thankyou very much :)

thank you very much :)

You are welcome :)

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.