I'm not going to make a tutorial about it, but I attached an example program that uses multithreading to show you how useful it is.
Virusscan:
Virus total
Jotti
Source code:
[php]
Public Class frmMain
#Region "All the code used Without multithreading"
Private Sub btnFreezeWithoutMultithreading_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFreezeWithoutMultithreading.Click
Dim MsgBoxAnswer As String = MsgBox("Freezing the thread will make the application freeze for 5 seconds." & vbCrLf & "Do you wish to continue?", MsgBoxStyle.YesNo, "Freeze Thread")
If MsgBoxAnswer = vbYes Then
btnClickMe.Enabled = True
Threading.Thread.Sleep(5000)
btnClickMe.Enabled = False
MsgBox("Thread is back and running!", vbInformation, "Back")
End If
End Sub
Private Sub btnClickMeWithoutMultithreading_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClickMe.Click
MsgBox("Wow, good job!", vbExclamation, "")
End Sub
#End Region
#Region "This is all the code used for Multithreading"
Dim threadFreeze As System.Threading.Thread
Dim WithEvents threadFreezeMe As cFreezeME
Private Sub btnClickMeWithMultithreading_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click
MsgBox("Meh, that was easy." & vbCrLf & "Thread status: " & threadFreeze.ThreadState.ToString, , "")
End Sub
Private Sub btnFreezeWithMultithreading_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFreezeWithMultithreading.Click
Dim MsgBoxAnswer As String = MsgBox("Freezing the thread will NOT make the application freeze for 5 seconds." & vbCrLf & "Do you wish to continue?", MsgBoxStyle.YesNo, "Freeze Thread")
Dim threadFreezeMe As New cFreezeME
threadFreeze = New Threading.Thread(AddressOf threadFreezeMe.FreezeME)
If MsgBoxAnswer = vbYes Then
btnClick.Enabled = True
threadFreeze.Start()
End If
End Sub
'Create a new class so we can do cross-class calls.
Public Class cFreezeME
Public Function FreezeME()
Threading.Thread.Sleep(5000)
Return MsgBox("Thread woke up!", vbInformation, "Ooh noes!")
End Function
End Class
#End Region
End Class
[/php]