VB.NET – Multi Thread

Background worker :

If not bw.IsBusy Then
bw.RunWorkerAsync()
End If

Friend WithEvents bw As New System.ComponentModel.BackgroundWorker

Private Sub bw_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles bw.DoWork
End Sub

Private Sub bw_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bw.RunWorkerCompleted

Dim mForm As New Form1()
mForm.BringToFront()
mForm.TopMost = True
mForm.Owner = Me
mForm.Show()

End Sub

 

Delegate :

Dim deleg1 As SomeWorkDelegate = New SomeWorkDelegate(AddressOf AfficherDelegate)
FaireDelegate(deleg1)

Public Delegate Sub SomeWorkDelegate(ByVal strSomeString As String)

Sub AfficherDelegate()
End Sub

Public Sub FaireDelegate(ByVal someDelegateFunc As SomeWorkDelegate)
Dim mFormChrono As New TempsPasse()
mFormChrono.BringToFront()
mFormChrono.TopMost = True
mFormChrono.Owner = Me
mFormChrono.Show()
End Sub

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s