Let we have label in main form and we want to update this label by next thread not by current thread
code here
declare delegate
delegate void Setlabel(string label);
call method
private void SetTextlabel(string label)
{
if (this.textBox1.InvokeRequired)
{
Setlabel d = new Setlabel(SetTextlabel);
this.Invoke(d, new object[] { label });
}
else
{
this.lb_text.Text = label;
}
}
now pass test to label by calling
setTextlable("Vinay Bhaskar Semwal");
Vijay Bhaskar Semwal
Visiting faculty
Madhaya Pradesh Technical University
MOD EDIT: When posting code...USE CODE TAGS!!!
This post has been edited by JackOfAllTrades: 03 February 2011 - 05:46 AM

New Topic/Question
Reply




MultiQuote







|