Accesseing UI element from Chield Thread.
In windows application, many times it is required to access/manipulated ui threads control property from chield thread.
Basically UI thread block its control. So if you normally try to access control property from different thread then exception will raise. So you need to do work-around.
Indivisual Invokation is required to solve the problem. Every ui control has a boolean property name InvokeRequired and a method invoke(delegate). You first need to check its invokation is required or not. If yes then call invoke() with a delegate.
I just want to change a button caption from a chield thread.
public partial class Form1 : Form
//declare a delegate
public delegate void SetData();
private void button1_Click(object sender, EventArgs e)
//Create a chield thread.
Thread t = new Thread(
//Run the thread.
private void SetCaptionToButton()
//Create a delegate
Delegate del = Delegate.CreateDelegate(typeof(SetData),
//Either 1 or 2 the following statement you can use.
button1.Text = "Click ME!";