Results 1 to 3 of 3

Thread: Stop all downloading objects

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2007
    Posts
    33

    Question Stop all downloading objects

    When I close my form it automatically stops all downloads within the application.

    I have a number of different objects including web services and picture boxes all simultaniously downloading different things.

    How can I stop all downloads in my app, something like the stop button of internet explorer is a good example?

    Something like Me.allDownloadingProcesses.Stop().

    It must be possible as it occurs when the application is closed.

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

    Re: Stop all downloading objects

    Many of those objects would inbuilt ways for you to stop a download. For instance, the PictureBox has a LoadAsync method to load an Image and CancelAsync will stop it. When you exit all your objects are disposed so they cease to exist as far as the OS is concerned. You don't want to do that if your app is still running so you need to look at each individual object and determine how to cancel its operation. Often it will be just like the PictureBox: call an asynchronous method instead of the synchronous equivalent so you can cancel if and when desired.
    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
    Member
    Join Date
    Aug 2007
    Posts
    33

    Re: Stop all downloading objects

    Quote Originally Posted by jmcilhinney
    Many of those objects would inbuilt ways for you to stop a download. For instance, the PictureBox has a LoadAsync method to load an Image and CancelAsync will stop it. When you exit all your objects are disposed so they cease to exist as far as the OS is concerned. You don't want to do that if your app is still running so you need to look at each individual object and determine how to cancel its operation. Often it will be just like the PictureBox: call an asynchronous method instead of the synchronous equivalent so you can cancel if and when desired.
    I know I can do them all individually but that is not an option, I just want to be able to stop them all at once, even if I have to dispose them.

    I tried disposing multiple picture boxes but it does not stop the downloading???

    I tried to cancelAsync of a list of picture boxes but there is a bug in the cancelAscnc method that kills all future loadAsync methods (Thanks Microsoft)

    Surely there is some me.stopDownloads() or some method that will have this effect?

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