dimanche 20 juin 2021

Using Invoke Method in an IF statement vb.net

I am using a TCP client/server to receive information from a micro controller and using that information inside a Win Forms App, VB.NET. My issue is trying to check a label against a datatable in an IF statement. I have tried different forms of invoke but none of them seem to work. VB Code

If lblStep.Invoke(New MethodInvoker(Sub() lblStep.Text = lblStep.Text), Nothing) = dt.Rows(0).Item("Step") Then
'Do something
end if

The error I am receiving is a multi thread error.

Aucun commentaire:

Enregistrer un commentaire