Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2005

Tip: Looking for answers? Try searching our database.

FileSystemWatcher not firing changed event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony - 11 Dec 2004 05:43 GMT
I have setup a FileSystemWatcher to fire an event when the specified file is
modified.
But the event never fires for some reason and the file is being modified.

I have pasted the setup code below. I must be doing something wrong (I have
verified the file names and path as being correct).

Tony

           m_oFileSystemWatcher                     = new
FileSystemWatcher();
           m_oFileSystemWatcher.NotifyFilter        =
NotifyFilters.LastWrite;
           m_oFileSystemWatcher.Path                =
Path.GetDirectoryName(sLocalFilename);
           m_oFileSystemWatcher.Filter              =
Path.GetFileName(sLocalFilename);
           m_oFileSystemWatcher.Changed             += new
FileSystemEventHandler(OnFileSystemWatcher_Changed);
           m_oFileSystemWatcher.EnableRaisingEvents = true;

        private void OnFileSystemWatcher_Changed(object sender,
FileSystemEventArgs e)
        {
           m_bFileModified = true;
        }
David W. Rogers - 03 Jan 2005 18:49 GMT
Perhaps the path is the problem. Are you specifying a "fully rooted" path in
sLocalFileName, as in "driveletter:\blah-blah"? If not, you may not be
setting the watcher on the directory you think you are.

David

> I have setup a FileSystemWatcher to fire an event when the specified file is
> modified.
[quoted text clipped - 22 lines]
>             m_bFileModified = true;
>          }
Tony - 05 Jan 2005 05:36 GMT
Yes, it is a full path name including drive letter.

Tony

> Perhaps the path is the problem. Are you specifying a "fully rooted" path
> in
[quoted text clipped - 31 lines]
>>             m_bFileModified = true;
>>          }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.