I am trying to change a label on the form during a background worker process However it says unhandled exception. I've looked at the error and it said to invoke it like the accepted answer says here: [Update label text in background worker winforms](https://stackoverflow.com/questions/15759688/update-label-text-in-background-worker-winforms)

I have done this successfully with changing values inside a checkbox list, but I've used the same method and for the label it won't invoke, I get the red error line in the code when I type it.

My Background Worker:

```
private void bw2_DoWork(object sender, DoWorkEventArgs args)
{
    BackgroundWorker worker = sender as BackgroundWorker;
    func.sshConnect();
    for (int num = 0; num < checklist.Items.Count; num++)
    {
        if (checklist.GetItemChecked(num))
        {
            string project = checklist.Items[num].ToString();
            lblStatus.Text = "Opening " + project + "..."; //error here
            if (func.svnCheckoutProject(project))
            {
                lblStatus.Text = project + " Opened"; //same error here
                func.sshRunCommand("echo " + project + " >> " + Properties.Settings.Default.serverUserFilesPath + Properties.Settings.Default.Username);
            }
            else
            {
                //error message
            }
        }
        worker.ReportProgress(num * (100 / checklist.Items.Count));
    }
}

```

I've tried replacing the lines with errors with this, but in visual studio it gives it a red line under invoke and won't let me build it.

```
lblStatus.Invoke((MethodInvoker)delegate { lblStatus.Text = "Opening " + project + "..."; });

```

Visual studio points me to here when the error appears: [MSDN](http://msdn.microsoft.com/query/dev12.query?appId=Dev12IDEF1&l=EN-US&k=k(EHInvalidOperation.WinForms.IllegalCrossThreadCall);k(TargetFrameworkMoniker-.NETFramework,Version%3Dv4.5);k(DevLang-csharp)&rd=true)
I used this method for the checkbox list and it worked but try it for the label and it doesn't work.

Any ideas of why it isn't working or another way of doing this?