Nguyen Duc Hoa

Nguyen Duc Hoa

  • NA
  • 7
  • 15.6k

MultiThread in C#

May 20 2007 7:04 AM
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)