Me.Invoke in VB.NET doesn't actually invoke Invoke - the thread lingers in the Invoke expression

I have the following code:

Public Delegate Sub SetStatusBarTextDelegate(ByVal StatusText As String)
Private Sub SetStatusBarText(ByVal StatusText As String)
    If Me.InvokeRequired Then
        Me.Invoke(New SetStatusBarTextDelegate(AddressOf SetStatusBarText), StatusText)
    Else
        Me.labelScanningProgress.Text = StatusText
    End If
End Sub

The problem is that when I call subStatusBarText from another thread, InvokeRequired is True (as it should be), but then my threads stop on the Me.Invoke statement - pausing execution shows that they all just sit there, without actually referring no matter what.

Any thoughts on why the threads seem to be afraid of Invoke?

+5
source share
1 answer

Invoke . , . (, ), .

+5

All Articles