TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vishan S Gill
NA
15
13.7k
Array of Labels
May 15 2011 11:37 AM
Hi Guys,
I've been looking through the internet for my kind of problem, but so far I could not find anything. I'm trying to add multiple labels dynamically in a loop into a Panel. Below is my code:
labelArray = new Label[orderedFoodCount];
for (int i = 0; i < orderedFoodCount; i++)
{
MessageBox.Show("round: " + i.ToString());
labelArray[i] = new Label();
labelArray[i].Name = "Label" + i.ToString() + "";
labelArray[i].Location = new System.Drawing.Point(100, i + 40);
panelSummary.Controls.Add(labelArray[i]);
labelArray[i].Text = "Testing: " + i.ToString();
}
It only shows me the first array, ie, labelArray[0]. Any idea why? I've checked the loop and it runs accordingly and shows me the counter in each run.
Thanks,
Vish
Reply
Answers (
3
)
How to apply password protection on pendrive with c#
I want to scroll data from database like fields are(id,description,image)