Friday, September 9, 2011

Cross Thread Exception in Same thread in WinForm Controls

recently i came across problem over rich text box control,on updating string 

richTextBox1.Text += "Client Started" + Environment.NewLine;

Is replaced by

Invoke(new Action(() => richTextBox1.Text += "Client Started" + Environment.NewLine));

Note: if You're using .net 2.0runtime build declare 
public delegate void Action();//do not return the value
write it outside of a class.













No comments :