You may not call Invoke
on the list box, but on the form. For WinForms applications I use something like:
...
this.Invoke((MethodInvoker)delegate()
{
// Do stuff on ANY control on the form.
});
...
Depending on the .NET version, you may have to declare a delegate for MethodInvoker
yourself as
public delegate void MethodInvoker();
However, you might also consider using the ReportProgress
feature of the Background Worker. The respective event handler should be called in the context of the form’s thread.