Imports System.Threading Module ThreadingDisplay Sub Main() Dim firstThread As New Thread(New ThreadStart(AddressOf Fun1)) Dim secondThread As New Thread(New ThreadStart(AddressOf Fun2)) firstThread.Start() secondThread.Start() firstThread.Join() secondThread.Join() Console.WriteLine("End of Main Thread...") Console.ReadLine() End Sub Sub fun1() Dim i As Integer For i = 1 To 10 Console.WriteLine("From 1st Thread i= " + i.ToString()) Thread.Sleep(1000) Next End Sub Sub fun2() Dim j As Integer For j = 20 To 11 Step -1 Console.WriteLine("From 2nd Thread j= " + j.ToString()) Thread.Sleep(1000) Next End Sub End Module
Visual Basic dot net VB.net programming microsoft .net framework object oriented language network enabled technology visual basic 2005 IDE integrated development environment console application microsoft cre common runtime environment
Threading Example
Subscribe to:
Post Comments (Atom)
java servlets
ReplyDelete