Cross-thread operation not valid
Hello
I have a program with the main thread (SampleForm) and another thread (thesecondthread).
When I try to create a label on thesecondthread, I get an error on the "Controls.Add(statuslabel2)" line:
Help!
Thank you.
Hello
I have a program with the main thread (SampleForm) and another thread (thesecondthread).
Code:
Sub thesecondthread()
Dim statuslabel2 As New Label
statuslabel2.Location = New System.Drawing.Point(10, 569)
:::
ETCETERA
:::
Controls.Add(statuslabel2)
End sub
When I try to create a label on thesecondthread, I get an error on the "Controls.Add(statuslabel2)" line:
Code:
Cross-thread operation not valid: Control 'SampleForm' accessed from a thread other than the thread it was created
on.
Help!
Thank you.