忍者ブログ
暇人おやじの暇なつぶやき
[89] [88] [87] [86] [85] [84] [83] [82] [81] [80] [79]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

■フォルダー監視とかって、フリーソフトを探したものだ

FileSystemWatcherってコンポーネントがアル

これってめちゃくちゃ簡単にファイルやフォルダーの監視を行なってくれる
作成、削除、リネーム等々

恐ろしく簡単に監視ができる

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        FileSystemWatcher1.Path = TextBox1.Text
        FileSystemWatcher1.EnableRaisingEvents = True


    End Sub

    Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed
        MsgBox("Changed:" & e.Name)
    End Sub

    Private Sub FileSystemWatcher1_Created(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Created
        MsgBox("Created:" & e.Name)
    End Sub

    Private Sub FileSystemWatcher1_Deleted(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Deleted
        MsgBox("Deleted:" & e.Name)
    End Sub

    Private Sub FileSystemWatcher1_Renamed(ByVal sender As System.Object, ByVal e As System.IO.RenamedEventArgs) Handles FileSystemWatcher1.Renamed
        MsgBox("Renamed:" & e.Name)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        FileSystemWatcher1.EnableRaisingEvents = False
    End Sub
End Class


PR


トラックバック
この記事にトラックバックする:


忍者ブログ [PR]
カレンダー
08 2024/09 10
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
フリーエリア
最新CM
最新TB
プロフィール
HN:
忍者 シオ才
性別:
非公開
バーコード
ブログ内検索