By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,369 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,369 IT Pros & Developers. It's quick & easy.

FileSystemWatcher.NotifyFilter mystery

P: n/a
..Net 2.0 in VB
Watcher = New FileSystemWatcher()
AddHandler Watcher.Changed, New FileSystemEventHandler(AddressOf
AddHandler Watcher.Created, New FileSystemEventHandler(AddressOf
AddHandler Watcher.Deleted, New FileSystemEventHandler(AddressOf
AddHandler Watcher.Renamed, New RenamedEventHandler(AddressOf Watcher_Renamed)
AddHandler Watcher.Error, New ErrorEventHandler(AddressOf Watcher_Error)
' Watcher.NotifyFilter = NotifyFilters.Attributes Or NotifyFilters.Security

Watcher.Path = WatchDir.Text
Watcher.Filter = WatchMask.Text
Watcher.EnableRaisingEvents = True

This code works fine for me.
However, if I uncomment the NotifyFilter statement, the create and delete
handlers are never triggered. The rename handler is not triggered either, but
if I rename a file, it shows up in the change handler. If I change a text
file, say I load it in notepad and save it, the change handler triggers, even
though neither the security not attributres changed. Nothing changed, not
even the size, other than the access date. Yet the handler triggered, though
the filter supposedly limits what changes it looks for.

What went wrong?

Apr 25 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.