Posted by: Sourav | September 30, 2016

ParameterizedThreadStart Delegate ,Lambda Expression in Thread Example in VB,VB Teacher Sourav,Kolkata 09748184075


Imports System.Threading
Module Module1

Sub Main()
Console.WriteLine(“Please enter the target number”)
Dim obj As Object = Console.ReadLine

Dim number As numbers = New numbers
‘Dim parameterizedthreadstart As ParameterizedThreadStart = New ParameterizedThreadStart(AddressOf number.printnumbers)
‘Dim t1 As Thread = New Thread(parameterizedthreadstart)
Dim t1 As Thread = New Thread(AddressOf number.printnumbers)
t1.Start(obj)

Console.ReadLine()

End Sub

End Module

Public Class numbers
Public Sub printnumbers(ByVal number As Object)
Dim num As Integer = 0
If Integer.TryParse(number.ToString, num) Then

Dim i As Integer
For i = 1 To number
Console.WriteLine(i)

Next
End If
End Sub

End Class

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: