Here is a sub code inside a module named \"Blahing\":
Sub BlahBlah(ByVal Count As Long)
For i As Long = 0 To Count
frmBlaher.txtBlah.Appe
Run your code a little bit different, This is how the Structure should look like for Multithreading in vb.net ( it has something to do with Vb.net not passing Namespaces into Models from what i Understand )
This would be your startThread from MainThread in load or w/e have you
Private Sub DoSomethingSimple()
Dim DoSomethingSimple_Thread As New Thread(AddressOf DoSimple)
DoSomethingSimple_Thread.Priority = ThreadPriority.AboveNormal
DoSomethingSimple_Thread.Start(Me)
End Sub
This would be the actual thread Itself ( new model / class or in the same class )
Private Sub DoSimple(beginform As Form)
'Do whatever you are doing that has nothing to do with ui
'For UI calls use the following
SomethingInvoked(PassibleVariable, beginform)
End Sub
Write a Delegate and Invoke Method for Each Call to the Main Thread.
Delegate Sub SomethingInvoked_Delegate(s As Integer, beginform As Form)
Sub SomethingInvoked_Invoke(ByVal s As Integer, beginform As Form)
If beginform.NameOfControlYouAreUpdating.InvokeRequired Then ' change NameOfControlYouAreUpdating to the Name of Control on the form you wish to update
Dim d As New SomethingInvoked_Delegate(AddressOf SomethingInvoked_Invoke)
beginform.Invoke(d, New Object() {s, beginform})
Else
'Do something...
beginform.NameOfControlYouAreUpdating.Condition = Parameter
End If
End Sub
This is tested ( non hanging ) way of writing Threads in vb.net
If you need further help implementing your code to this Template let me know :P