Hallo VB.NET's
We are trying to use FindFirstChangeNotification under VB6
and FileSystemWatcher with vb.net and got no success on drives mapped with
InterDriveClient (5.0,7.11) on
a NetApp NFS System.
On Local Drives the code is working.
Also on SAMBA drives it is not working.
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
watcher = New FileSystemWatcher
' watcher.Path = WatchPath.Text
watcher.NotifyFilter = NotifyFilters.FileName Or NotifyFilters.Size Or
NotifyFilters.DirectoryName
watcher.IncludeSubdirectories = True
AddHandler watcher.Changed, AddressOf OnChanged
AddHandler watcher.Created, AddressOf OnChanged
AddHandler watcher.Deleted, AddressOf OnChanged
AddHandler watcher.Renamed, AddressOf OnRenamed
watcher.EnableRaisingEvents = False
Button1.Text = "&Start Observation"
End Sub
Public Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)
MessageBox.Show(e.FullPath, "Changed triggered", MessageBoxButtons.OK,
MessageBoxIcon.Information)
' Console.WriteLine("Datei: {0} {1}", e.FullPath,
e.ChangeType.ToString("G"))
End Sub
Public Sub OnRenamed(ByVal source As Object, ByVal e As RenamedEventArgs)
MessageBox.Show(e.FullPath, "Renamed triggered", MessageBoxButtons.OK,
MessageBoxIcon.Information)
' Console.WriteLine("Datei: {0} wurde umbenannt in {1}", e.OldFullPath,
e.FullPath)
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Directory.Exists(WatchPath.Text) = False Then
MessageBox.Show(WatchPath.Text, "Directoy not exists error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
watcher.Path = WatchPath.Text
If (watcher.EnableRaisingEvents = True) Then
watcher.EnableRaisingEvents = False
Button1.Text = "&Start Observation"
Else
watcher.EnableRaisingEvents = True
Button1.Text = "&Stop Observation"
End If
End If
End Sub
Is this generally not working?
Are there workarounds?
Many Thanks.
A.Reisenhofer