How is this block of code being called? Is this code being called from some other thread you created or in asynchronous operation?
This is the error you typically see if you spin off your own secondary threads (manually or use a "BackgroundWorker") to perform work that is trying to manipulate controls. The controls are "owned" by the initial/primary thread (this is the UI thread). No other thread can make changes to the controls created on the UI thread. You need to transition calls back to the UI thread to do this. This is usually done by calling the Invoke method on the form class that holds the control you want to change. The Invoke method invokes the handler provided to it on the thread it was created on, thus transitioning the control manipulation call back to the proper thread.
-Peter
peterlanoie.blog