Created
May 7, 2010 13:52
-
-
Save mpj/393445 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
delegate void SetTextCallback(Control ctrl, string value); | |
void SetControlText(Control ctrl, string value) | |
{ | |
// InvokeRequired required compares the thread ID of the | |
// calling thread to the thread ID of the creating thread. | |
// If these threads are different, it returns true. | |
if (ctrl.InvokeRequired) | |
{ | |
SetTextCallback d = new SetTextCallback(SetControlText); | |
this.Invoke(d, new object[] { ctrl, value }); | |
//d.Invoke(lbl, txt); | |
//this.Invoke(d, new object[] { text }); | |
} | |
else | |
{ | |
ctrl.Text = value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment