Hi All,
Am using a delegate
delegate void MyDelegate(bool show);
and accessing delegate using
Invoke(new MyDelegate(ShowProgressBar), true);
public void ShowProgressBar(bool show)
{
Progressbar1.Visible = show;
}
I need to run another function on button click
btnstart_click
{
Invoke(new MyDelegate(ShowProgressBar), true);
RunProgressbarfunction();
Invoke(new MyDelegate(ShowProgressBar), false);
}
Problem is Runprogressbarfunction accessing Form controls and assigning values for properties on run time (i.e. label1.visible=true;) and getting the below error.I have peeped thru google.Tried all methods still showing the same error.anyone could resolved this?
Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.
Loading
CrishPosted Dec 15, 2010, 4:20 AM
If you want to get detail about progressbar than just go through this below link.
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/01fa8584-cb7c-4cac-befe-a933938a1886/