Был код на VS 2003 перетащил на 2005:
Public Class Aclass
Public frm As New frm993
Public s1, nameB_S
Public Event ThreadDone(ByVal s1 As String)
Public Sub Potok1()
do while ...
\\\\
LOOP
s1 = ""
RaiseEvent ThreadDone(s1)
end sub
End Class
Sub AreaDoneEventHandler(ByVal s1 As String) Handles obj.ThreadDone
'Me.ListBox2.Items.Add("Подразделение: " & Trim(nameB_S))
Me.ListBox2.Refresh()
Me.ListBox2.Items.Add("Расчет Закончен!")
Me.ListBox2.Refresh()
Me.ListBox2.Items.Add("_____________________________________")
Me.ListBox2.Refresh()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.ListBox1.Refresh()
th1 = New Thread(New ThreadStart(AddressOf obj.Potok1))
th1.Start()
End If
---------------------------------------------------------------------------------
В Sub AreaDoneEventHandler(ByVal s1 As String) Handles obj.ThreadDone ругается на
Cross-thread operation not valid: Control 'ListBox2' accessed from a thread other than the thread it was created on.
Помогите как вылечить
Лучше примерчик небольшой
Спасибо!