1. do the process that reports the progress asynchronously. Look at backgroundworker component, and use it ReportProgressChanged event for this purpose. Yes, this component runs on another thread and not on the same UI thread.So it will be responsive. Look at the snippet below for better understanding.
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
backGroundWorker.RunWorkerAsync()
End If
End Sub
Private Sub backGroundWorker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles backGroundWorker.DoWork
backGroundWorker.ReportProgress(0)
Try
'Do that intensive work here.
Catch ex As System.Excpetion
'
End Try
backGroundWorker.ReportProgress(100)
End Sub
Private Sub backGroundWorker_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles backGroundWorker.RunWorkerCompleted
'done
End Sub
Private Sub backGroundWorker_ProgressChanged(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles backGroundWorker.ProgressChanged
progressBar.Value = e.ProgressPercentage
End Sub
2. Use the DoEvents Method of the System.Windows.Forms.Application class to process messages. Add that call before the progress report message calls.
Like,
System.Windows.Forms.Application.DoEvents();