我从后台工作者调用以下代码,但不是设置所需的文本,而是将应用程序标题添加到lisbox 有什么问题
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
答案 0 :(得分:2)
当您调用委托(Text
)时,您将获取表单的...New Object() {[Text]} ...
属性。您希望在委托调用中发送sStatus
参数:
If Me.lsbLog.InvokeRequired Then
Dim d As New SetTextCallback(AddressOf SetStatus)
Me.lsbLog.Invoke(d, New Object() {sStatus})
''# ...and so on