2020年8月31日 星期一

vb.net 資料夾監視 [Watch folder action]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        FileSystemWatcher1.Path = "C:\Test\"
    End Sub

    Private Sub FileSystemWatcher1_Changed(sender As Object, e As IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed
        MsgBox(e.FullPath.ToString)
    End Sub

    Private Sub FileSystemWatcher1_Created(sender As Object, e As IO.FileSystemEventArgs) Handles FileSystemWatcher1.Created
        MsgBox(e.FullPath.ToString)
    End Sub





1
2
3
4
5
6
7
    Private Sub FileSystemWatcher1_Deleted(sender As Object, e As IO.FileSystemEventArgs) Handles FileSystemWatcher1.Deleted
        MsgBox(e.FullPath.ToString)
    End Sub

    Private Sub FileSystemWatcher1_Renamed(sender As Object, e As IO.RenamedEventArgs) Handles FileSystemWatcher1.Renamed
        MsgBox(e.FullPath.ToString)
    End Sub

沒有留言:

張貼留言