I have a simple C# 4.0 Windows Forms form that make an instance of a FileSystemWatcher which watches a directory. When a file is added, the proper event fires, and I do some stuff in another directory. Then I make an instance of a child form. The child form hangs, and controls do not paint.
I think this is because the FileSystemWatcher is on a different thread, even though it looks like I am launching from the main form. What is the proper way to call a child form from a FileSystemWatcher event on what I think is another thread?
Set the
FileSystemWatcher.SynchronizingObjectproperty to your main form.MSDN: