I was creating an application wich send data over the network from client to server.
(An application for calling somebody over a network , like a bell on a housedoor).

I created a thread wich connects the server and client , i wanted to refresh a label in the statusbar of the server-side application wich displayed the operation that was working.

In c# the most common thing you can do is this :
1. Create a delegate for your function you want to use in the invoke thread.
private delegate void UpdateLogCallback(string strMessage);
2. Update the form, you can use this.invoke
this.Invoke(new UpdateLogCallback(this.UpdateLog), new object[] { “Connected Successfully!” });
3. the function wich is called from the connection-thread :
private void UpdateLog(string strMessage)
{
lblsts.Text(strMessage);
}

In WPF you can’t use the invoke method after this.

To work arround this you can use the the Invoke methods on the associated dispatcher :
lblSts.Dispatcher.Invoke(new UpdateLogCallback(this.UpdateLog), new object[] { “Connected Successfully!” });