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
Piyush chhabra
NA
83
16.8k
Deleting a programatically added label in c# win app.
Jun 16 2014 1:42 AM
hello everyone..
i am trying to make a windows form application in c# using visual studio 2008.
in this i have added 1 button. on form load i am adding one label at run time.
now i want to delete that label on click of button1. here is my code--->
private void Form1_Load(object sender, EventArgs e)
{
Label lb = new Label();
lb.Text = "hello";
lb.AutoSize = true;
lb.Visible = true;
lb.name = "l1";
lb.Location = new Point(100, 200);
this.Controls.Add(lb);
}
private void button1_Click(object sender, EventArgs e)
{
this.Controls.RemoveByKey(lb);
}
but i am getting a compilation error that " name lb does not exist in the current context"
what is going wrong.. please HELP...!!!
Reply
Answers (
2
)
richtextbox
select n row of data table by loop