Repeat one control many times using for loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kamakshi k
    New Member
    • Jan 2012
    • 1

    Repeat one control many times using for loop

    is it possible to repeat one control many times using for loop?
    like,
    for(i=0;i<5;i++ )
    {
    textbox1.text;
    }
    anybody know plz help me
  • Paul Johnson
    New Member
    • Oct 2010
    • 97

    #2
    I'm confused. Are you trying to place 5 copies of textbox1 onto a page or are you trying to change textbox1 while it's on the page?

    If it's putting 5 copies onto the page, you can - but not in the way you've got it (think about using an array with each textbox being placed onto the page at a different position).

    If it's to change the contents then you can

    [code]
    for(int i = 0; i < 5; ++i)
    {
    textbox1.Text += foo[i] + "-";
    }

    where foo is some array or list

    A clearer question would help here though...

    Comment

    Working...