I get the error \"Cross-thread operation not valid: Control \'label1\' accessed from a thread other than the thread it was created on.\" when I run this code:
us
While the "Accepted" answer is technically correct (in that this will fix the problem) this doesn't answer the question.
The ANSWER is to use
void T_Elapsed(object sender, ElapsedEventArgs e)
{
this.BeginInvoke(new MethodInvoker(delegate(){
label1.Text = "This will work";
}));
}
http://jaysonknight.com/blog/archive/2007/02/14/using-anonymous-methods-for-control-invoke-control-begininvoke.aspx