How do I change a property in a windows form from another class’ method?
Lets say I have Form1 with a label that says “Hello”, if I want to change that message to something else using a method from another class, how can i refere to that label?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Easiest way – change your label visibility to
publicand passForm1instance to that method. Correct one – declare public propertyMessageon yourForm1class like this:And also pass instance of form to your method: