how to use Invoke method in a file of extensions/methods?
Change
Invoke((UpdateState)delegate …
to
label.Invoke((UpdateState)delegate …
You forgot to specify the label in your code (when you call the Invoke method):
public static void ShowMessage(this Label label, string text) { if (label.InvokeRequired) { lablel.Invoke((UpdateState)delegate { label.Text = text; }); } else { label.Text = text; } }
also, consider using BeginInvoke instead so you won't block the calling thread (if applicable)