都说是bug咯,你要自己绑定事件啊。
全局代码
Public Sub OnDeleted(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs)
msgbox(e.FullPath)
End Sub
Public Sub OnCreated(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs)
msgbox(e.FullPath)
End Sub
Public Sub OnRenamed(ByVal source As Object, ByVal e As System.IO.RenamedEventArgs)
msgbox(e.FullPath)
End Sub
Public Sub OnChanged(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs)
msgbox("OnChanged" & e.FullPath & "e.ChangeType:" & e.ChangeType.ToString())
End Sub
调用代码
Dim watcher As new System.IO.FileSystemWatcher()
watcher.Path = "D:\test\"
watcher.Filter = "*.*"
watcher.IncludeSubdirectories = True
addhandler watcher.Changed, addressof OnChanged
addhandler watcher.Renamed, addressof OnRenamed
addhandler watcher.Deleted, addressof OnDeleted
addhandler watcher.Created, addressof OnCreated
watcher.EnableRaisingEvents = True