How to use BackgroundWorker in Visua by glsachin33


									How to use BackgroundWorker in Visual Basic
The most important part of Windows applications are their abilities to
run the processes in the background. This can be done in the Visual Basic
by using the BackgroundWorker component in VB.

A brief of using that Background worker.

Background worker contains two major Function DoWork and
RunWorkerCompleted. The DoWork is to be triggered by any way and the
RunWorkerCompleted method will be called automatically by the Backgrund
Worker. This background worker can carry on processes in the background
while the interface still is user interactable.

An Example for Using BackgroundWorker

This will trigger the Background Worker.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End Sub

This will be processed once the background worker intiates.

Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal
e As System.ComponentModel.DoWorkEventArgs) Handles
MsgBox "Background Process is intiated"
End Sub

This will notify once process is finished.

Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As
System.Object, ByVal e As
System.ComponentModel.RunWorkerCompletedEventArgs) Handles
Msgbox "Process has been finished"
End Sub

To top