Possible Duplicate:
How to update GUI from another thread in C#?
Following scenario: I have a class with some GUI elements (winforms). This class has a update method which changes things on the controls. I also have a FileSystemWatcher. This object gives me a callback whenever a file changes. In that case I call the update method.
As you might guess this makes the application crash. The reason: the callback from the FileSystemWatcher is in another thread that the one that created the controls. If I then call the update method it can't access the controls.
What is the way to fix this? Thanks!