I have an application that has these functions:-
If no data file exists, read the files in a folder and create a new data file.
Read the data file.
Display its contents.
It also has a folder watcher which if it detects a newly created file in the folder, raises an event.
This event reads this file and adds it's details to the data file.
But now the problem:
I then try to re-display its contents.
I get a cross thread problem. Obviously raising the event creates a new thread.
I tried using the Delegate method, but there are too many functions, and the code will (I think) get too confusing.
I thought that I could omit the display routine, and put a button on the form to re-display it, thinking that by pressing the button, I would be back in the original thread. Yes and no. Mostly yes, but an important class no longer initialised, so can I be back on the original thread?
I am using Visual Basic in VS2008
Thanks for any ideas.