techmanbd
Junior Contributor
First here is my code. Question at the bottom.
the sub that starts a test
the sub to do the thread
So I don't have a LOT of lines of the thread, I made a sub to run the thread. How can I pass through the name of the sub to make the "addressof" for? I was thinking passing the name of the sub to start as a string, but how can I make sure the thread nows that is the sub I want to start as a thread? That is if that is a way to do it.
the sub that starts a test
Visual Basic:
Private Sub startTest()
If Me.chckIVFAT.Checked Then
runTestThread(NAME_OF_SUB)
End If
If Me.chckIVFELO.Checked Then
runTestThread(NAME_OF_SUB)
End If
If Me.chckIVDO.Checked Then
runTestThread(NAME_OF_SUB)
End If
End sub
the sub to do the thread
Visual Basic:
Private Sub runTestThread(NAME_OF_SUB)
thrdTest = New Thread(AddressOf NAME_OF_SUB)
thrdTest.IsBackground = True
thrdTest.Start()
Do
Application.DoEvents()
Loop While thrdTest.ThreadState.Running
End Sub
So I don't have a LOT of lines of the thread, I made a sub to run the thread. How can I pass through the name of the sub to make the "addressof" for? I was thinking passing the name of the sub to start as a string, but how can I make sure the thread nows that is the sub I want to start as a thread? That is if that is a way to do it.