Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Deleting dynamicaly created labels in visual c#
Piyush chhabra
Jun 16 2014 8:57 AM
811
Reply
hello everyone..
i have created a windows form app using visual c#.
in this i have added 10 labels on my form on a button click event.
now on clicking second button, i want 5 out of 10 lables deleted or disappears.
here is my code for making labels.
private void button1_Click(object sender, EventArgs e)
{
for (int f = 0; f < l10; f++)
{
Color randomcolor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
lbl1 = new Label(); // lbl1 is a object of label class declared outside
lbl1.Text = " ";
lbl1.BackColor = randomcolor;
lbl1.Location = new Point(li[f], 20);
lbl1.Size = new Size(40, 20);
this.Controls.Add(lbl1);
}
}
now how shoud i code in button2 click event..
private void button2_Click(object sender, EventArgs e)
{
???????????????????????????????????
}
PLEASE HELP..!!
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How to show windows form on tooltip
Deleting dynamically added labels