Something like that:
int i = Convert.ToInt32(textbox1.Text);
while(i > 0)
{
GroupBox mygroupbox = new GroupBox();
foreach (Control ctrl in this.Controls)
{
if(ctrl is GroupBox)
{
GroupBox gbx = (GroupBox)ctrl;
mygroupbox = gbx;
break;
}
}
this.Controls.Add(mygroupbox);
i--;
}
Regards,
KZ