Progress bar is not running
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.