2011-03-12 6 views
0

오전, 당신이 양식의 픽업안전 크로스 스레드 호출 오류

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 

답변

2

그것은 잘못 무엇인지 lisbox 에 응용 프로그램 캡션을 추가 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