Imports System
Imports System.Threading
Public Class Form1
Dim t1 As Thread
Dim t2 As Thread
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CheckForIllegalCrossThreadCalls = False
t1 = New Thread(New ThreadStart(AddressOf pro1))
t1.Start()
t2 = New Thread(New ThreadStart(AddressOf pro2))
t2.Start()
End Sub
Sub pro1()
Dim count As Integer = 0
While (True)
ProgressBar1.PerformStep()
count += ProgressBar1.Step
Thread.Sleep(100)
If count = 20 Then
t2.Join()
End If
End While
End Sub
Sub pro2()
Dim count As Integer = 0
While (True)
ProgressBar2.PerformStep()
count += ProgressBar2.Step
Thread.Sleep(100)
If count = 100 Then
Exit Sub
End If
End While
End Sub
End Class