I will be showing you how to use Multi-Threading,
Why is this useful? Instead of having a linear flow of data, you can split up the work load into threads so while you have, for example a counter going, you can have progress be updated to a progress bar as that is happening.
Start by opening up a blank project (NOTE: I am using Visual Basic 2008)
I discovered this after wondering why my Visual Basic application wasn't responding whenever i tried to execute a hefty amount of code, the multi-threading fixed it.
Why is this useful? Instead of having a linear flow of data, you can split up the work load into threads so while you have, for example a counter going, you can have progress be updated to a progress bar as that is happening.
Start by opening up a blank project (NOTE: I am using Visual Basic 2008)
Code:
Imports System.Threading.Thread
Private Class Test
Dim TestThread As System.Threading.Thread 'Define the thread/thread name
Private Sub Main_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Dim TestThread As New System.Threading.Thread(AddressOf TestSub) 'Address the sub which will contain code for our thread
Control.CheckForIllegalCrossThreadCalls = False 'Allows you to make calls changes to windows form/other threads
TestThread.Start() 'Initialize the thread
End Sub
Public Sub TestSub()
'Code here
End Sub
End Class
I discovered this after wondering why my Visual Basic application wasn't responding whenever i tried to execute a hefty amount of code, the multi-threading fixed it.



