There is a groupBox in which I want to add a form.

  for (int i = 0; i < 4; i++) { Form2 frm = new Form2(); groupBox.Controls.Add(frm); } 

Displays error. Is there a workaround to display the form in control?

enter image description here

    1 answer 1

    It was originally

     public partial class Form2 : Form 

    after adding UserControl instead of Form

      public partial class Form2 : UserControl