smashapps

FileSystemWatcher

May 16th, 2011
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.     Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed
  4.         TextBox1.Text = TextBox1.Text & vbNewLine & "A file was changed"
  5.     End Sub
  6.  
  7.     Private Sub FileSystemWatcher1_Created(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Created
  8.         TextBox1.Text = TextBox1.Text & vbNewLine & "A file was created"
  9.     End Sub
  10.  
  11.     Private Sub FileSystemWatcher1_Deleted(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Deleted
  12.         TextBox1.Text = TextBox1.Text & vbNewLine & "A file was deleted"
  13.     End Sub
  14.  
  15.     Private Sub FileSystemWatcher1_Renamed(ByVal sender As System.Object, ByVal e As System.IO.RenamedEventArgs) Handles FileSystemWatcher1.Renamed
  16.         TextBox1.Text = TextBox1.Text & vbNewLine & "A file was renamed"
  17.     End Sub
  18. End Class
  19.  
  20. '
  21. 'Add a textBox and a FileSystemWatcher
  22. 'You will need to set a path for the filesystemwatcher to know where it is looking
  23. '
Add Comment
Please, Sign In to add comment