End Google Ads 201810 - BS.net 01 --> Hi,
I am relatively new to c# and I am trying to utilize a background worker to run the progressBar however I am not getting beyond 1% in the following example. In the Form1_Load I have an iteration inside which I want to display the ProgressBar. Appreciate if someone can point out where I am going wrong with this logic.

Pat



namespace WindowsFormsApplication1
{

public partial class Form1 : Form
{
BackgroundWorker bgw = new BackgroundWorker();
float tot1=100;
float cnt1=0;
float rslt = 0;
int percents = 0;
public Form1()
{
InitializeComponent();
label1.Text = "";
label2.Text = "";
}


void bgw_DoWork(object sender, DoWorkEventArgs e)
{
{
System.Threading.Thread.Sleep(500);
rslt = ((cnt1 / tot1) * 100);
percents = Convert.ToInt32(rslt);
bgw.ReportProgress(percents, cnt1);
}
}

void bgw_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
label1.Text = String.Format("Progress: {0} %", e.ProgressPercentage);
label2.Text = String.Format("Total items transfered: {0}", e.UserState);
}

void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
//do the code when bgv completes its work
}

private void Form1_Load(object sender, EventArgs e)
{
for (cnt1 = 0; cnt1