By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,325 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,325 IT Pros & Developers. It's quick & easy.

Repeat one control many times using for loop

P: 1
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
Jan 5 '12 #1
Share this Question
Share on Google+
1 Reply

Paul Johnson
P: 97
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...
Jan 16 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.