Don't you have something better to do than drop stupid comments on this forum!? Fool. I had a problem - Vikram was kind enough to point me in the direction of a solution - why do you even bother to give feedback if the feedback isn't worth anything...?? I don't understand that... Thomas
tsiv
Posts
-
Windows form and filesystem watcher threading issue -
Windows form and filesystem watcher threading issueHi Thanks a lot for the help. Used the invoke method and it works like a charm! Kind regards Thomas
-
Windows form and filesystem watcher threading issueHi I have a problem while using the Filesystem watcher component in conjunction with a Windows form application. I'm trying to do the following: The form should show the content based on af file (which can be modified from another application!) and this should be done dynamically while the form runs... So what I've done is to add a standard form to the app and then build the form contents dynamically based on the information contained in a file. The form contents is a panel and on that some labels and picture boxes... So I would like to register a filesystem event monitor to detect when the file changes and re-create the Panels contents dynamically...now the problem occus...! When trying to update the panel I get an error saying that: Cross-thread operation not valid : Control 'pnlUpdates' accessed from a thread other than the thread it was created on. The line of code that causes this error is: pnlUpdates.Controls.Add(lblTest); I suppose it is because the filesystem watcher is running in another thread and therefore this is not allowed?? I tried to use a backgroundworker to allow the update but this fails if I start the process from the OnChanged event of the Filesystem eventwatcher (same thread error as above)... Anyone who knows how this can be done? Kind regards Thomas