C# Updating GUI from different thread

void MyEventHandler(object sender, EventArgs e)
{
if (this.InvokeRequired)
{
this.Invoke(new EventHandler(MyEventHandler), new object[] { sender, e }
);
}else{
//update GUI here
}
}
void MyEventHandler(object sender, MyEventArgs e)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new EventHandler<MyEventArgs>(MyEventHandler), new object[] { sender, e });
}
else
{
//update GUI here
}
}

Comments

Popular posts from this blog

Tibco Rendezvous (tibrv) C# .Net example

Parse XML to dynamic object in C#