I am using FileSystemWatcher to copy the contents of a text file after it has been updated but it is creating the same avent more than once i was wondering if anyone could tell me if there is a way to stop it doing that so it will only copy the contents once.
Here is my code any help would be great.
Dim FileGoto As String
FileGoto = "c:\watch\"
If e.ChangeType = IO.WatcherChangeTypes.Changed Then
'To Copy File
'System.IO.File.Copy(e.FullPath, FileGoto & e.Name)
Dim TextLine As String = ""
Dim objReader As New System.IO.StreamReader(e.FullPath)
Do While objReader.Peek() <> -1
TextLine = TextLine & objReader.ReadLine() & vbNewLine
Loop
TextBox1.Text = TextLine
Dim objWriter As New System.IO.StreamWriter(FileGoto & e.Name, True)
objWriter.Write(TextBox1.Text)
objWriter.Close()
End If
Many thanks