Modify form label from new thread


I have a form with 2 labels and 2 buttons

Button1 changes the label1.Text of the form // works fine

Button2 starts a new thread and the method is supposed to change label2.Text

However I get compile time error:

"error CS0120: An object reference is required for the non-static field, method, or property"

How can I modify label2.Text from that other thread?

Advice appreciated.


Ignore, I was going about my task in completely the wrong way.

Question Self-Answered as of 5 Years Ago

Hi, please check this link, it talks about exactly what you need to know :)

if it doesn't help you, please paste your code snippet and we'll figure out what's wrong.

Hope it helped

This question has already been solved: Start a new discussion instead
Start New Discussion
Tags Related to this Article