Hey munishk, I had developed and application that created approximate of 20 Background workers. All these workers had to update progressbars embedded in a listview for around 20 listview items. However, initially the DoWork event handler used to update the UI which made the UI very sloppy and was sometimes showing a hung behavior. I changed the implementation to make use of Delegates to update the UI and by calling the BeginInvoke method this issue got resolved.
// declare a delegate to update your progress
void delegate UpdateProgressDelegate(object params);
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
//Do Intensive Work
ArgumentClass backGroundCls = e.Argument as ArgumentClass;
//Now you can do whatever you want to do with passed arguments
int ctr=0;
do
{
ctr++;
UpdateProgressDelegate del = new UpdateProgressDelegate(UpdateProgress);
del.BeginInvoke(ctr, null, null);
} while (ctr < 10000000);
}
private void UpdateProgress(int ctr)
{
// update progress here
}
This should definitely work and solve your issue.
Sunil