creating controls within loop
i have have formula adds new cells list fills calm boxes.
the proceed i've coded distant works fine:
tablecell tcell1 = new tablecell();
tablecell tcell2 = new tablecell();
tablecell tcell3 = new tablecell();
tablecell tcell4 = new tablecell();
tablecell tcell5 = new tablecell();
tablecell tcell6 = new tablecell();
tablecell tcell7 = new tablecell();
textbox txt1 = new textbox();
textbox txt2 = new textbox();
textbox txt3 = new textbox();
textbox txt4 = new textbox();
textbox txt5 = new textbox();
textbox txt6 = new textbox();
textbox txt7 = new textbox();
tcell1.controls.add(txt1);
tcell2.controls.add(txt2);
tcell3.controls.add(txt3);
tcell4.controls.add(txt4);
tcell5.controls.add(txt5);
tcell6.controls.add(txt6);
tcell7.controls.add(txt7);
trow.cells.add(tcell1);
trow.cells.add(tcell2);
trow.cells.add(tcell3);
trow.cells.add(tcell4);
trow.cells.add(tcell5);
trow.cells.add(tcell6);
trow.cells.add(tcell7);
as there's fundamentally 4 instructions removing steady 7 times. i'm certain there proceed accomplish only 4 lines formula within loop carrying names boldly indifferent nonetheless i only can't seem anything indicate me instruction it.
something following i'm after:
(int i = 0; i < 6; i++)
{
tablecell tcell[i] = new tablecell();
textbox txt[i] = new textbox();
tcell[i].controls.add(txt[i]);
trow.cells.add(tcell[i]);
}
any assistance many appreciated.
Comments
Post a Comment