Ho bisogno di monitorare la creazione di file all'interno di una directory utilizzando il componente FileSystemWatcher, ma non riesco a farlo funzionare.
Il codice che utilizzo è il seguente:

Imports System.Timers
Imports System.IO
Imports System.IO.FileSystemWatcher

Namespace Listener

Module Listener

Public Sub Main()

Dim fsw As New FileSystemWatcher("C:\daMonitorare")

fsw.NotifyFilter = NotifyFilters.LastWrite

AddHandler fsw.Created, AddressOf OnCreated

fsw.EnableRaisingEvents = True

End Sub

Public Sub OnCreated(ByVal source As Object, ByVal e As FileSystemEventArgs)
MsgBox("File: " & e.FullPath & " " & e.ChangeType)
End Sub

End Module
End Namespace





DOVE STO SBAGLIANDO?????

Grazie a tutti