

You can combine the notify filters to watch for one or more than one type of changes, eg. The NotifyFilter property is used to specify the type of changes you want to watch. ' Set this property to true to start watchingītn_stop.Enabled = True ' End of code for btn_start_click ' add the rename handler as the signature is different AddHandler watchfolder.Renamed, AddressOf logrename ' add the handler to each event AddHandler watchfolder.Changed, AddressOf logchangeĪddHandler watchfolder.Created, AddressOf logchangeĪddHandler watchfolder.Deleted, AddressOf logchange Watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _

Watchfolder.NotifyFilter = IO.NotifyFilters.DirectoryName ' Add a list of Filter we want to specify ' make sure you use OR for each Filter as we need to ' all of those

Watchfolder = New System.IO.FileSystemWatcher() Call it WatchFolder and click OK:Ĭreate a user interface as shown in the image below. NET and create a new Windows Application Project. NET if you want to experiment with the source code presented in this article. NET framework installed, as well as Visual Studio In this article we're going to learn how to implement the FileSystemWatcher class using Microsoft Visualīasic. System.Diagnostics, which contains the FileSystemWatcher class which can raises events when a file is created/renamed/updated or deleted from the specified folder or any other activities. NET Framework has introduced classes like System.IO and The windows APIs to do something like this which was not very simple and required lots of coding. Raises events when there is any activity in that folder? In the good old days using VB6 or older you had to use Ever wanted to write an application which constantly monitors a folder and
