I'm trying to change the text of a label in Form1 (Windows Forms) from an external class. To do that I've done this inside the external class:
public static class ExternalClass
{
static MyClass myClass = new MyClass();
public static void myMethod()
{
myClass.lblMyLabel.Text = ("My Text");
}
}
I don't get any errors or such so it looks like it should work but when using the application the text won't change, what's the easiest way to solve this?
After searching around on this page I've found that the code I wrote above should be enough seen to their solutions.
I've tried to call non static a method in the Form1 class through the myClass. operator(?) with no result.
Also I've tried to use a string method with get; set; that been pointed to the label and it's value that's told to work in lots of threads with no result, so now I'm out of ideas.
Preferably there should be a way to work with the code in the example.