..Net 2.0 in VB
Watcher = New FileSystemWatcher()
AddHandler Watcher.Changed, New FileSystemEventHandler(AddressOf
Watcher_Changed)
AddHandler Watcher.Created, New FileSystemEventHandler(AddressOf
Watcher_Created)
AddHandler Watcher.Deleted, New FileSystemEventHandler(AddressOf
Watcher_Deleted)
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?
Thanks,
Jon