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. C#
  4. Progress Bar

Progress Bar

Scheduled Pinned Locked Moved C#
tutorial
6 Posts 3 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.
  • T Offline
    T Offline
    The_Soul_Of_Rock
    wrote on last edited by
    #1

    How to create a process bar like this: +------------------------------------------+ | Processing....... | |------------------------------------------| | | | Please wait...... | | +-----------------------------------+ | | | | | | | | | | | | | | | +-----------------------------------+ | | 50 % | | 10 Second Remaining | +------------------------------------------+ Thanks. Rock Throught The Night

    H 1 Reply Last reply
    0
    • T The_Soul_Of_Rock

      How to create a process bar like this: +------------------------------------------+ | Processing....... | |------------------------------------------| | | | Please wait...... | | +-----------------------------------+ | | | | | | | | | | | | | | | +-----------------------------------+ | | 50 % | | 10 Second Remaining | +------------------------------------------+ Thanks. Rock Throught The Night

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Use the ProgressBar and a few Label controls. If you want to treat this whole thing as a single control, consider extending UserControl and put all this in it. Add some properties and methods to that user control, such as a Minimum, Value, and Maximum properties, and perhaps a Step method (similar to the ProgressBar). These would be used to set the properties on the ProgressBar, and when the Value is updated, also update the Label with the percent remaining (although the addition of such a control and a progress bar is a waste of screen real estate). As far as time remaining, that's really a question of implementation. There's no generic way of handling it. You have to calculate or estimate the total and remaining time as you perform your operations.

      Microsoft MVP, Visual C# My Articles

      T 1 Reply Last reply
      0
      • H Heath Stewart

        Use the ProgressBar and a few Label controls. If you want to treat this whole thing as a single control, consider extending UserControl and put all this in it. Add some properties and methods to that user control, such as a Minimum, Value, and Maximum properties, and perhaps a Step method (similar to the ProgressBar). These would be used to set the properties on the ProgressBar, and when the Value is updated, also update the Label with the percent remaining (although the addition of such a control and a progress bar is a waste of screen real estate). As far as time remaining, that's really a question of implementation. There's no generic way of handling it. You have to calculate or estimate the total and remaining time as you perform your operations.

        Microsoft MVP, Visual C# My Articles

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

        but how to calculate or estimate the total and remaining time as you perform your operations. thanks Rock Throught The Night

        H L 2 Replies Last reply
        0
        • T The_Soul_Of_Rock

          but how to calculate or estimate the total and remaining time as you perform your operations. thanks Rock Throught The Night

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Like I said - it's completely dependent on your implementation. If you were download a file or files, for example, you'd get the total number of bytes for the max value, increment the current value as you download bytes, and keep a running average that you'd use to estimate the time. Only you can answer this question. If you've estimated that each operation takes 5 minutes, the multiple the number of operations by 5 and decrement in 5 minute intervals. Again, only you can say.

          Microsoft MVP, Visual C# My Articles

          T 1 Reply Last reply
          0
          • H Heath Stewart

            Like I said - it's completely dependent on your implementation. If you were download a file or files, for example, you'd get the total number of bytes for the max value, increment the current value as you download bytes, and keep a running average that you'd use to estimate the time. Only you can answer this question. If you've estimated that each operation takes 5 minutes, the multiple the number of operations by 5 and decrement in 5 minute intervals. Again, only you can say.

            Microsoft MVP, Visual C# My Articles

            T Offline
            T Offline
            The_Soul_Of_Rock
            wrote on last edited by
            #5

            ok thanks Rock Throught The Night

            1 Reply Last reply
            0
            • T The_Soul_Of_Rock

              but how to calculate or estimate the total and remaining time as you perform your operations. thanks Rock Throught The Night

              L Offline
              L Offline
              LongRange Shooter
              wrote on last edited by
              #6

              I have put a few of these together, and determining the percentages and getting the bar to move properly is not the easiest if you do it yourself. For example: if you have a task you want to show this progress bar for and you created a record, notified one server of the new record, notified the database queue of the record, then created a summary page of the data, then you would have four tasks. However you can only set the value to 0, 25, 50, 75, 100 for those four values. If, however, you take a look at here : Pretty Good Splash Screen[^] it contains the code to do a smooth progress bar. You can take the snippet of code from here and it manages the real time for each task. The first iteration it displays a blank page. All remaining iterations it displays a smooth progress bar. Enjoy ______________________________ The Tao gave birth to machine language. Machine language gave birth to the assembler. The assembler gave birth to ten thousand languages. Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao. Beauty exists because we give a name to C#. Bad exists because we give a name to COBOL.

              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