Joining Threads in VB.net
By: Steven Holzner
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.
Example:
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
Archived Comments
1. Antoinette
View Tutorial By: Payday loans at 2012-06-27 04:36:00
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Using Resume Next and Resume Line in VB.net
Using On Error GoTo 0 in VB.net
Getting an Exception's Number and Description in VB.net
Raising an Exception Intentionally in VB.net
Exception Filtering in the Catch Block in VB.net
Using Multiple Catch Statements in VB.net
Throwing an Exception in VB.net
Throwing a Custom Exception in VB.net
Changes in Controls from VB6 to VB.net
Unstructured Exception Handling in VB.net