Results 1 to 4 of 4

Thread: Progress bar with downloading

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Progress bar with downloading

    There is a button called "Data Refresh". Once user clicks it, a few jobs will start:
    truncate 5 tables in local SQL server, insert data into 5 tables in local server from remote SQL server. It will take about 15 seconds.
    How to add progress bar with data refresh?

  2. #2
    Fanatic Member
    Join Date
    Nov 2007
    Posts
    520

    Re: Progress bar with downloading

    What code do you have already?

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

    Re: Progress bar with downloading

    It's important to understand that you cannot report progress to the user if you cannot measure progress yourself in code. If what you do is simply call a method and that method returns and the job is done then there's no way you can report progress on that. All you know is that the task is about to start (progress = 0&#37 and the task has ended (progress = 100%), so that's all you can report to the user.

    If your task is done in parts then you need to first calculate the proportion of the whole that each part represents. Let's say that you have 4 parts to your task. Does each task represent an equal proportion of the whole? If so then you can set your Minimum to 0, your Maximum to 4 and simply increment your Value after each part. If each part is not equal then it's up to you to assign a weight to each one. If the first three parts are equal but the last one takes four times longer then you might set the Maximum to 7 and increment by 1 after each of the first three tasks and then to 7 after the fourth. You might also set the Maximum to 100 and then assign a percentage of the whole to each part.

    Basically, it's all up to you. You have to assign a weight to each part, you have to calculate the combined weight of the completed parts after each one completes. Again, as I said before, if you can't measure progress then you can't report it. If your task can't be broken into parts then you can't report progress. If your task can be broken into parts then do so and simply put a bit of code after each part to report the proportion of the whole that has completed.
    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

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Re: Progress bar with downloading

    Thank you. I understood now.

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