Hello,
I am trying to have a sub repeat an action every so often (happens to be a random timing) and my program freezes when I try to sleep the thread. Below is a general structure of the sub the thread is executing.
Any possible solutions? I do NOT want to use the Timer control.
Private Sub DoStartBuying()
If Me.InvokeRequired Then
Dim args As Object() = {}
Me.Invoke(New DoStartBuyingDelegate(AddressOf DoStartBuying), args)
Else
'Some variable declarations
'Multiple controls being casted, for example:
'Dim txtRefreshMin As TextBox
'Dim txtRefreshMinC() As Control = tabAccount.TabPages(1).Controls.Find("txtRefreshMin" & intThreadID, True)
'txtRefreshMin = DirectCast(txtRefreshMinC(0), TextBox)
Do Until bolRunning(intThreadID - 1) = False
'Executes some code here, including a web request
Thread.Sleep(5000)
Loop
End If
End Sub
Thanks