A thread is a fork of operation within the application
To create a new one put this at top of code under Class but not in a sub
VB.NET Code:
Private running As Boolean = True
Private t As Threading.Thread
Then put these in the correct places
VB.NET Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
t = New Threading.Thread(New Threading.ThreadStart(AddressOf threadfunc))
t.IsBackground = True
t.Start()
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
running = False
If t.IsAlive AndAlso (Not t.Join(1000)) Then
t.Abort()
End If
End Sub
Private Sub threadfunc()
While running
'PUT YOUR CODE HERE
End While
End Sub