Created
August 15, 2019 07:34
-
-
Save ahvahsky2008/904b4ceec61549a3d064254eb4a8d083 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
txtbox1.Invoke(() => toolStripProgressBar1.Value = value);