![]() I felt that using a list to keep track of the folders and files was better for performance then re-parsing the file system every time a subfolder was deleted. ![]() Eventually, I found it easier to break this functionality off into a new class that I could adapt for reuse. My solution was to create a list in order to compare file paths of the files contained in the folder to the path of the sub folder being deleted. This makes it a bit more difficult to keep track of the directory structure. If you set the file system watcher object to include subdirectories, when you delete a subdirectory that has files contained in it the event raised by the file system watcher will only show the event for that subdirectory being deleted not for any of the files contained in that directory. I did, after watching the events closely, come across one caveat. When I first started tinkering around with the file system watcher component everything worked as expected. ![]() Basically, to use the file system watcher component you have to first set permissions to full trust, create a new file system watcher object, set its properties, create handlers for the events the file system watcher object raises, and then set it to enable raising events. Microsoft provides enough example code in their documentation to give any new user a great head start. Using the.net file watching component is pretty simple on the surface. Net with Visual Basic, you’re able to watch a directory structure for changes to its contents and respond with Visual Basic code. Utilizing the Microsoft file system watcher component in. Just a quick post on using the Microsoft file system watcher component in the.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |