Use of FileSystemWatcher ???

G

Guest

Dear all,

I have a Windows VB application which monitor a folder for new created XML
files.
This with the use of FileSystemWatcher components.
My application is just monito the Change event

The list of files that belongs to that folder are displayed in a treeView
control.
From that treeview control, when a node is selected, I am reading the file
content into a dataset bind to a datagrid.

It works perfectly well from the application side but as soon as I start to
cut and past file, manually by using WIndows explorer, it crash windows
explorer itself but my application is still running perfecly well.

How could this be happen, does SystemFileWatcher component does or lock
something on the monitor folder ? or does my reading XML file creates a lock
situatiion.

Does anyone could explain that situation ?

reagrds
serge
 
T

Thomas Scheidegger [MVP]

Hi serge

It works perfectly well from the application side but as soon as I start to
cut and past file, manually by using WIndows explorer, it crash windows
explorer itself but my application is still running perfecly well.


I guess it could also be a violation of STA-threading rules in your application.
Read all about
FileSystemWatcher.SynchronizingObject


FileSystemWatcher uses the Win32: ReadDirectoryChangesW API internally,
I don't think this will crash the Explorer.
 

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

Top