Wednesday, July 30, 2014

How can i make backgroundworker to report progress from a new class to a label in form1 ?

Ok i did now in form1:



void bgw_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
label3.Text = e.ProgressPercentage + " %";
}

And in the class in the DoWork event:



void bgw_DoWork(object sender, DoWorkEventArgs e)
{
for (int i = 0; i < allLinksToParse.Count; i++)
{
GetResponsersFN(allLinksToParse[i]);
int position = (int)Math.Round((i / 10f) * 100);
bgw.ReportProgress(position);
}
}



label3 end with 490%


No comments:

Post a Comment