Re: Thread problem!!Help me
What are you doing in ThreadStart?
Re: Thread problem!!Help me
I am willing code execution in this way:
1. Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
2.
3.
Try
4.
Do all the button click function here and after that call the thread
5.
Dim th1 As New Thread(AddressOf ThreadStart)
6.
th1.IsBackground = True
7.
th1.Start()
8. th1.Join()
Catch ex As Exception
DO something
9. End Try
10. End Sub
11. Private Sub Thread()
12. Do Something
13. end sub
Re: Thread problem!!Help me
Why do you not show us your real code?
Re: Thread problem!!Help me
I see that Join you have in there, but it wasn't in the first snippet. Was the first snippet real code, or was that left out?
Re: Thread problem!!Help me
Based on his description, i'll bet that th1.Join() is in his code.
memo, th1.Join() causes your current thread to spinwait until the other thread has finished its work. It then continues from that line. That's why your function is not exiting. Why are you using Join()?