problem with file watcher and datagrid

  • Thread starter Thread starter R.A.
  • Start date Start date
R

R.A.

Hi

I have a class which contains a datagrid and a file watcher object.
When the file watcher event is triggered then in the event handler I add
rows to the data grid. the problem is that every time I add rows to the
datagrid from the file watcher event handler the program stops - there are
no exceptions thrown the program just terminates. I have checked the
datagrid without adding rows in the file watcher handler and there are no
issues. I need to get the file name from the file watcher handler so that I
will display the file name in the datagrid.
Any ideas what is happening?



Thanks
 
Did you set the SynchronizingObject of the FileSystemWatcher to the data
grid object (or maybe your form object)? I think if you do that then the
events will come back on your UI thread -- which is the only safe place to
muck with UI objects.

Brad Williams
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top