1
Answer

MultiThread in C#

Nguyen Duc Hoa

Nguyen Duc Hoa

17y
2.1k
1
Hello everybody. I have a question. I'm using C# on Microsoft Visual Studio 2005. I have a function (Search). An a cmd_SingleThread button has code { Search(); } When I click, everything is OK but I have second button, called MultiThread button has code { Thread th=new Thread(ThreadStart(Search)); th.Start(); } When I click this button, it always inform a Exception called InvalidOperationException. "Cross-thread operation not valid: Control 'listBox1' accessed from a thread other than the thread it was created on." Can you explain? Thank you

Answers (1)
Next Recommended Forum