Skip to content

Instantly share code, notes, and snippets.

@santhotech
Created April 29, 2011 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santhotech/948162 to your computer and use it in GitHub Desktop.
Save santhotech/948162 to your computer and use it in GitHub Desktop.
delegate void SetCtrlCallback(string val, property p, Control ctrl);
private void SetCtrl(string value, property p, Control ctrl)
{
if (ctrl.InvokeRequired)
{
SetCtrlCallbackd = new SetCtrlCallback(SetCtrl);
this.Invoke(d, new object[] { val,p,ctrl });
}
else
{
ctrl.p= val;
}
}
so that i can call from with in another thread
SetCtrl("mytext",Text,Button1)
SetCtrl("mytext",Text,Button2)
SetCtrl(color.green,BackColor,Button1)
SetCtrl(color.green,ForeColor,Button1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment