I have an application where I am looking for a text file and if there are any changes made to the file I am using the OnChanged
eventhandler to handle the event
I approached the double create issue like this, which ignores the first event:
Private WithEvents fsw As New System.IO.FileSystemWatcher
Private complete As New List(Of String)
Private Sub fsw_Created(ByVal sender As Object, _
ByVal e As System.IO.FileSystemEventArgs) Handles fsw.Created
If Not complete.Contains(e.FullPath) Then
complete.Add(e.FullPath)
Else
complete.Remove(e.FullPath)
Dim th As New Threading.Thread(AddressOf hprocess)
th.Start(e)
End If
End Sub