C# – Change Label Text in opened Form from another Class

I am coding a Program in C# using WinForms which has language Support, means a user can for example change the Program Language from English to German.

Now I have Form1 with Label1 and a Class1.

Class1 has a public void method named Translate() and it should translate the text of the Label1. It does that by executing Translate() at the Form1 Load Event but which doesn’t work for me.

I tried it with the following code in Form1:

 private void Form1_Load(object sender, EventArgs e)
    {
        new Class1(Translate());
    }

Code in Class1:

 public void Translate()
    {
        if (Language.Equals(1))
        {
            new Form1().Label1.Text = "English Translated Text";
        }
        else if(Language.Equals(2))
        {
            new Form1().Label1.Text = "German Translated Text";
        }
    }

It probably doesn’t work since It changes the Text Label at a new Form instead of changing it on the already opened form but I don’t know how to make it work using the code that I already have.

Answer

As suggested, pass the Form via this:

private void Form1_Load(object sender, EventArgs e)
{
    Class1 c1 = new Class1();
    c1.Translate(this));
}

In Translate():

public void Translate(Form1 f1)
{
    if (Language.Equals(1))
    {
        f1.Label1.Text = "English Translated Text";
    }
    else if(Language.Equals(2))
    {
        f1.Label1.Text = "German Translated Text";
    }
}

*This assumes, however, that Label1 is publicly accessible on Form1. Controls are not publicly accessible by default. To fix this, change the Modifiers property of Label to public.

But the real solution lies in implementing Localization.