By: Steven Holzner Viewed: 403 times Printer Friendly Format
You can use the Join method to wait until a thread finishes; this method will return when the thread is finished executing. Here are the various forms of this method:
Sub Join- Waits for a thread to die.
Function Join(TimeOut As Integer) As Boolean -Waits for the thread to die or for a specific timeout, given as a number of milliseconds, to elapse. Returns True if the thread died, False if the call timed out.
Function Join(TimeOut As TimeSpan) As Boolean- Waits for the thread to die or for a specific timeout, given as a TimeSpan object, to elapse. Returns True if the thread died, False if the call timed out.
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Thread1.Start() Thread2.Start() Thread1.Join() Thread2.Join() TextBox1.Text = c.Total End Sub
Most Viewed Articles (in VB.net )
Latest Articles (in VB.net)
Comment on this tutorial
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews