Reputation: 5951
Am calling the following code from backgroundworker, but instead of setting the desired text, it add the application caption to the lisbox what is wrong with it
Private Sub SetStatus(ByVal sStatus As String)
If Me.lsbLog.InvokeRequired Then
Dim d As New SetTextCallback(AddressOf SetStatus)
Me.lsbLog.Invoke(d, New Object() {[Text]})
'// Me.Invoke(Sub() SetStatus(sStatus))
Else
If Mid$(LCase$(sStatus), 1, 4) = "sent" Then
tslSent.Text = "Sent:" & FormatNumber(lSent, 0, TriState.False)
Else
lsbLog.Items.Add(sStatus)
End If
End If
End Sub
Upvotes: 0
Views: 229
Reputation: 158289
You pick up the form's Text
property when you invoke the delegate (...New Object() {[Text]} ...
). You want to sent the sStatus
argument in the delegate call instead:
If Me.lsbLog.InvokeRequired Then
Dim d As New SetTextCallback(AddressOf SetStatus)
Me.lsbLog.Invoke(d, New Object() {sStatus})
''# ...and so on
Upvotes: 2