Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem with Progress Bar

Problem with Progress Bar

Scheduled Pinned Locked Moved Visual Basic
help
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pathak78
    wrote on last edited by
    #1

    I have a problem : Description of problem: When I use coding to copy a large file like 700MB to a different location. It takes upto 5 minutes. So I want to show some continues working Progress Bar. But when it starts copy process all the activities hanged. No Progress bar visible at that time. Please give any solution.

    M T D 3 Replies Last reply
    0
    • P pathak78

      I have a problem : Description of problem: When I use coding to copy a large file like 700MB to a different location. It takes upto 5 minutes. So I want to show some continues working Progress Bar. But when it starts copy process all the activities hanged. No Progress bar visible at that time. Please give any solution.

      M Offline
      M Offline
      mr_lasseter
      wrote on last edited by
      #2

      You need to copy the file on a different thread. You should use the Background Worker class, but it is only available in .Net 2.0. Link for creating Background worker in .Net 1.1 http://www.devx.com/codemag/Article/20639?trk=DXRSS\_DOTNET How to use the Background worker in .Net 2.0 http://msdn2.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx VB6.0 Don't think it is easily possible.

      Mike Lasseter

      1 Reply Last reply
      0
      • P pathak78

        I have a problem : Description of problem: When I use coding to copy a large file like 700MB to a different location. It takes upto 5 minutes. So I want to show some continues working Progress Bar. But when it starts copy process all the activities hanged. No Progress bar visible at that time. Please give any solution.

        T Offline
        T Offline
        Taylor
        wrote on last edited by
        #3

        try progressbarname.refresh in loop that copies the file

        1 Reply Last reply
        0
        • P pathak78

          I have a problem : Description of problem: When I use coding to copy a large file like 700MB to a different location. It takes upto 5 minutes. So I want to show some continues working Progress Bar. But when it starts copy process all the activities hanged. No Progress bar visible at that time. Please give any solution.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Well, you've got a bit of a problem. Just putting a ProgressBar on a form doesn't do anything. You have to update it with, well, progress. If you're using the File.Copy method, you'll never get that progress. It's a blocking call that doesn't report anything during the copy. In order to make a progress bar work, you have to copy the file yourself using file stream methods. You know...open a file read some of it, write that to another file. Well, that's where you update the ProgressBar. You get the size of the file first, start copying the file, track how much of the file you've copied and update the ProgressBar as you're copying the file. Like the others have said, you can even move the copy operation to another thread so your UI stays responsive.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups