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
Developer
NA
9
12.9k
How to Change Label Text
Mar 10 2011 1:26 AM
Hi,
In my windows form i have a label and a button. Initially that label will be having some text. On click even of the button i will invoice a function written in different class, in that function i want to change the text of that label.
My Code is
In Form1.cs
1. I have changed modifiers of label to public
private void button1_Click(object sender, EventArgs e)
{
//Call class1's static Method
Class1.Test();
}
In Class1.cs
public static void Test()
{
//Creating the object of Form1
Form1 abc = new Form1();
//changing the label text
abc.lblTest.Text = "Text Changed";
}
By doing like this i am not able to change the text. What is the problem
Reply
Answers (
1
)
Failed to connect to server SERVER.
Script transfer failed.