Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ahvahsky2008/904b4ceec61549a3d064254eb4a8d083 to your computer and use it in GitHub Desktop.
Save ahvahsky2008/904b4ceec61549a3d064254eb4a8d083 to your computer and use it in GitHub Desktop.
public static class ControlEx
{
public static void Invoke(this System.Windows.Forms.Control @this, Action action)
{
if (@this == null) throw new ArgumentNullException("@this");
if (action == null) throw new ArgumentNullException("action");
if (@this.InvokeRequired)
{
@this.Invoke(action);
}
else
{
action();
}
}
}
@ahvahsky2008
Copy link
Author

txtbox1.Invoke(() => toolStripProgressBar1.Value = value);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment