CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2009
    Posts
    1

    FileSystemWatcher

    Hi all,
    I created a cshap application which monitors a shared folder over the network.
    I've done this by just dropping a FileSystemWatcher component on a form and setting its properties and events.
    Everything works fine, but sometimes my app stops monitoring without reporting any errors!

    It seems to do this when the connection with the folder is lost temporarily.
    (The same thing happens if you monitor a local folder on your C drive, if you delete the folder the application doesn't report any errors)
    How can I add an Error event to detect the folder I'm watching is no longer there or the connection with it is lost?
    Also, how do I force my application to restart monitoring once the connecting with the folder is
    re-established?

    Thanks for your help.

  2. #2
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    47

    Re: FileSystemWatcher

    Quote Originally Posted by Walidm View Post
    Hi all,
    I created a cshap application which monitors a shared folder over the network.
    I've done this by just dropping a FileSystemWatcher component on a form and setting its properties and events.
    Everything works fine, but sometimes my app stops monitoring without reporting any errors!

    It seems to do this when the connection with the folder is lost temporarily.
    (The same thing happens if you monitor a local folder on your C drive, if you delete the folder the application doesn't report any errors)
    How can I add an Error event to detect the folder I'm watching is no longer there or the connection with it is lost?
    Also, how do I force my application to restart monitoring once the connecting with the folder is
    re-established?

    Thanks for your help.
    Would you mind to show snippets of your code? I guess more people will be able to help you...
    Xander Tan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured