Everybody knows, that updating UI from background thread is not allowed (or not?)
I did a little experiment. Here is a piece of code:
var thread = ne
Like varocarbas says any component you put into your designer will throw Cross thread exception.
to access between thread you need to use invke, beginInvoke.
try to run
BackgroundWorker bw = new BackgroundWorker();
bw.DoWork += (s1,e1) =>
{
textBoxt1.Text = "foo"; // Exception here
}
bw.RunWorkerCompleted += (1s, e1) =>
{
textBoxt1.Text = "foo"; // No exception here off UI thread
}
bw.RunWorkerAsync();
instead replace
bw.DoWork += (s1,e1) =>
{
this.Invoke((MethodInvoker) delegate
{
textBoxt1.Text = message;
}); // No Exception now
}