Time ago I've seen a multi-threading technique code like this:
Private Delegate Sub TextBoxUpdateUI(ByVal txt As String)
Private t As Threading.Thread = New Threading.Thread(Sub() _
If tb2.InvokeRequired Then
Dim tb_delegate As New TextBoxUpdateUI(AddressOf "This Sub")
tb2.Invoke(tb_delegate, Text)
Else
tb2.Text = tb1.Text
End If _
)
The thing is that, be able to write some instructions inside the Thread argument, I don't remember well the example that I've seen but if I remember well it used a Lambda
like I've tried to use.
But the code above does not work, just I wanted to reproduce it, but I lost the example that I've seen so I don't know exactly how to write it.
Someone can fix the lambda?
Also, at the delegate line in the AdressOf
operator how could I fix it to refer to that?