Advertisement

08.12.2003 at 10:29PM PDT, ID: 20708008
[x]
Attachment Details

FileSystemWatcher fires twice for the same event..

Asked by zulu_11 in .NET

Tags: filesystemwatcher, twice, event

hi,
..i've made a windows service in which i keep watch on a particular directory and whenever a file is Created in that directory i'm running a code to enter the details in the SQLDB...

i've made the event on file Creation  but the problem is that whenever the file is created in that directory the FileSystemWatcher.Created event fires twice....with the result that all my code is running twice for the same event and i'm getting duplicated values in my DB

here's the code that i've written in VB.NET


Private Sub fsw_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles fsw.Created
        Select Case e.ChangeType
            Case IO.WatcherChangeTypes.Created
                ReadFile(e.FullPath)
        End Select
End Sub

so whenever a file is created this Sub is running twice...i can't understand why??

any ideas??

thanks in advance..

zulu

Start Free Trial
[+][-]08.13.2003 at 04:40AM PDT, ID: 9137774

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.13.2003 at 04:46AM PDT, ID: 9137802

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.13.2003 at 05:41AM PDT, ID: 9138150

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.13.2003 at 06:04AM PDT, ID: 9138305

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.13.2003 at 06:15AM PDT, ID: 9138398

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: .NET
Tags: filesystemwatcher, twice, event
Sign Up Now!
Solution Provided By: WorkingJourneyman
Participating Experts: 3
Solution Grade: A
 
 
[+][-]08.13.2003 at 06:18AM PDT, ID: 9138422

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.13.2003 at 06:48AM PDT, ID: 9138644

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.13.2003 at 07:03AM PDT, ID: 9138758

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.13.2003 at 09:00AM PDT, ID: 9139588

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32