C# how to add usercontrols dynamically in tabPage -


i not know how add usercontrol..

my code , control below

   private void button1_click(object sender, eventargs e)     {         test = new test[index];         (int = 0; < test.length; i++)         {             test[i] = new recordergenerator.test();             test[i].location = new point(0, * 20);             test[i].size = new size(100, 10);             test[i].tabindex = i;             test[i].backcolor = color.transparent;             test[i].autoscalemode = system.windows.forms.autoscalemode.none;             test[i].visible = true;             this.tabpage1.controls.add(test[i]);         }          index++;     } 

i try add other controls(e.g textbox) , possible.

but can not add control made me

follow these steps:

  1. make sure control behaves other control , can add manually in visual studio
  2. add control manually tab page
  3. inspect automatically generated code
  4. copy code (and modify accordingly)

Comments