Hi evoteam21 ,
Please refer below sample code.
Web Form
Here I created two web form.
Form1
Form2
Here I add empty form because when progress bar is 100 then it displays Form2 window.
Namespace
C#
using System.Threading;
VB.Net
Imports System.Threading
Code
C#
private void Form1_Load(object sender, EventArgs e)
{
backgroundWorker1.WorkerReportsProgress = true;
backgroundWorker1.RunWorkerAsync();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
for (int i = 1; i <= 100; i++)
{
Thread.Sleep(100);
backgroundWorker1.ReportProgress(i);
}
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
lblPercentage.Text = e.ProgressPercentage.ToString() + "%";
if (e.ProgressPercentage == 100)
{
Form2 frm2 = new Form2();
frm2.Show();
}
}
VB.Net
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
backgroundWorker1.WorkerReportsProgress = True
backgroundWorker1.RunWorkerAsync()
End Sub
Private Sub backgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
For i As Integer = 1 To 100
Thread.Sleep(100)
BackgroundWorker1.ReportProgress(i)
Next
End Sub
Private Sub backgroundWorker1_ProgressChanged(sender As System.Object, e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
ProgressBar1.Value = e.ProgressPercentage
lblPercentage.Text = e.ProgressPercentage.ToString() & "%"
If e.ProgressPercentage = 100 Then
Dim frm2 As Form2 = New Form2()
frm2.Show()
End If
End Sub
Screenshot