Results 1 to 5 of 5

Thread: [2005] WaitForChanged

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    [2005] WaitForChanged

    When the code below is called it seems to hang forever, any ideas why?


    Code:
        Private Sub fswRejectedClaims_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles fswRejectedClaims.Created
            Me.fswRejectedClaims.WaitForChanged(WatcherChangeTypes.Created)
    
            MsgBox("The files....")
        End Sub

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] WaitForChanged

    That event is raised when a file is created. By calling WaitForChanged you are telling it to wait right there until another file is created, at which point the event will be raised again and you'll wait again. What exactly are you trying to achieve?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    Re: [2005] WaitForChanged

    just trying to wait for the file to finish downloading before i import it into a table.

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] WaitForChanged

    does your program download this file itself? if so there isn't a need for a FSW....

    where does the file come from?

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] WaitForChanged

    Quote Originally Posted by texas
    just trying to wait for the file to finish downloading before i import it into a table.
    Assuming that you do need a FSW, the event is not raised, and thus the handler not executed, until a file is created, so telling it then to wait for a file to be created will wait for another file to be created because the one that raised the event has already been created, otherwise there would have been no event in the first place.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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