VB.NET FileSystemWatcher Multiple Change Events
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2009-01-16T10:19:10Z
Indexed on
2010/04/06
14:43 UTC
Read the original article
Hit count: 199
filesystemwatcher
|.NET
Hi. I have the following code:
Imports System.IO
Public Class Blah
Public Sub New()
InitializeComponent()
Dim watcher As New FileSystemWatcher("C:\")
watcher.EnableRaisingEvents = True
AddHandler watcher.Changed, AddressOf watcher_Changed
End Sub
Private Sub watcher_Changed(ByVal sender As Object, ByVal e As FileSystemEventArgs)
MsgBox(e.FullPath)
End Sub
End Class
When I run it and save changes to a file on my C drive, the code works great, except it executes the watcher_Changed() method four times. Any idea why? The changeType is "4" every time.
Thanks.
© Stack Overflow or respective owner