Hello I am studying multithreading with join method
I am trying to create multiple threads and run thread in order.
I know that join method is able to join threads and run threads in order.
However, form is updating text box, but whole form is freezing so i can't click any button in the form
Here is code that I have..
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click Dim T_List As New ArrayList Dim VALE As Integer = 99 For i = 0 To 2 VALE = i t = New Thread(New ThreadStart(Sub() run_t(VALE, 10 + (5 * VALE)))) t.IsBackground = True t.Start() t.Join() ' T_List.Add(t) Next End Sub Private Sub run_t(t_num As Integer, number As Integer) For i = 0 To number Thread.Sleep(100) CounterBox.AppendText("thread : " & t_num & " : " & i.ToString() + vbNewLine) If i Mod 2 = 0 Then ComboBox1.Items.Add(i) End If Next End Sub
I was checking "STATHREAD" STATHREAD and main thread and https://msdn.microsoft.com/en-us/library/ms182351.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
however, STATHREAD seems not working for this case.
what can be the solution to use Join method for threads without freezing form..