An object-oriented programming language developed by Microsoft that can be used in .NET.
Hi @Sani Love ,
The issue arises because On Error Resume Next and lambda expressions (used within the Invoke method) cannot coexist within the same method. The lambda expression captures the context where it's defined, and this conflicts with the error handling provided by On Error Resume Next.
Make sure UI updates happen on the UI thread.
If blah.InvokeRequired Then
blah.Invoke(Sub() UpdateText(blah, String.Empty))
Else
blah.Text = String.Empty
End If
' Define a separate method to update the text
Private Sub UpdateText(ByVal control As Control, ByVal text As String)
If control.InvokeRequired Then
control.Invoke(Sub() UpdateText(control, text))
Else
control.Text = text
End If
End Sub
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.