When option strict is OFF, works fine. ON, I get overload resolution failure:
Dim _thread1 As Thread
Private Sub test2(boolTest As Boolean)
' Do something
End Sub
'
Private Sub test()
_thread1 = New Thread(AddressOf test2)
_thread1.Start(True)
End Sub
Overload resolution failed because no accessible 'New' can be called with these arguments:
'Public Sub New(start As System.Threading.ParameterizedThreadStart)': Option Strict On does not allow narrowing in implicit type conversions between method 'Private Sub test2(boolTest As Boolean)' and delegate 'Delegate Sub ParameterizedThreadingStart(obj As Object)'.
'Public Sub New(start As System.Threading.ThreadStart)': Method 'Private Sub test2(boolTest As boolean)' does not have a signature compatible with delegate 'Delegate Sub ThreadStart()'.
I'm new to threading .. a function without parameters seems just fine, but WITH parameters? Tough. How can I do this? I searched already and mostly see java/js only answering this question.
See Question&Answers more detail:os