private void button1_Click(object sender, EventArgs e)
{
int Maxitem = 0;
Maxitem = 50000;
progressBar1.Maximum = 50000;
progressBar1.Value = 0;
for (int i = 0; i < Maxitem; i++)
progressBar1.Value += 1;
MessageBox.Show("completed");
progressBar1.Value = 0;
}
if you know maximum number of your loop program than in this loop you will place your progess bar.