Question: I have page control in main form and page controls in child form , I 
place the child form inside the main form by using docking features. 

I am not using MDI style

Now both forms have tabs in page control and I need to merge the child form 
tabs into the main form page control, what is the best way to do that?

Answer: 
This is a fairly simple approach that may or may not suit your needs.

For each child tab page you need to merge:

* Create a tab in the main form page
control corresponding to the child
tab
* Iterate over the **Controls** in the
child tab and change the **Parent**
property to the tab page you just
created

You do not need to deal with controls that are children of other controls. e.g. if you have a groupbox in your child tab, then changing it's parent will bring both it *and all controls within it* to the new parent.

If you need to be able to "unmerge" your tabs at any point then you will need to devise some mechanism to keep track of where the controls came from so you can restore the original **Parent** as/when needed.

To make things slightly easier you could place a **TPanel** in the child tabs, with it's **Align** property set to **alClient**. Place all the controls in the tab on that panel and then when you need to merge/unmerge you need only set the **Parent** of the panel control.
I just tried

```
procedure TForm1.Button1Click(Sender: TObject);
begin
  while Form2.PageControl1.PageCount > 0 do
    Form2.PageControl1.Pages[0].PageControl := PageControl1;
end;

```

and it worked fine. Am I missing something obvious, or why is everybody giving such sophisticated solutions? :-)