Can you explain in brief how can we implement threading
Can you explain in brief how can we implement threading ?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim pthread1 As New Thread(AddressOf Thread1) Dim pthread2 As New Thread(AddressOf Thread2) pthread1.Start() pthread2.Start() End Sub Public Sub Thread1() Dim pintcount As Integer Dim pstr As String pstr = “This is first thread” Do Until pintcount > 5 lstThreadDisplay.Items.Add(pstr) pintcount = pintcount + 1 Loop End Sub Public Sub Thread2() Dim pintcount As Integer Dim pstr As String pstr = “This is second thread” Do Until pintcount > 5 lstThreadDisplay.Items.Add(pstr) pintcount = pintcount + 1 Loop End Sub
Above is a sample code which shows simple sample code for threading. Above sample
code can be found in “Threading” folder in CD provided. Above sample has two methods
“Thread1()” and “Thread2()” which are started in multi-threaded mode in Form load
event of the sample.
Note :- If you run the sample you will see that sometimes the first thread runs first and then the second thread.
2007-10-22, 12289👍, 0💬
Write an equivalent expression for x%8? x&7
If we have the following in a Java code: String s="abc"; String s2="abc"; Then what will be output o...
How To Enter Binary Numbers in SQL Statements? - MySQL FAQs - Introduction to SQL Basics If you want...
How do you target a specific frame from a hyperlink? Include the name of the frame in the target att...
How Can we change priority & what levels of priority are provided by Dot Net? Thread Priority ca...