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. How to create a progressBar?

How to create a progressBar?

Scheduled Pinned Locked Moved C#
questiontutorial
16 Posts 7 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.
  • A Admin887

    hello, i just want to know how can i create a Progressbar that represent the progress of a specific Form. i mean, i have a Form with a lot of steps..that caculate a lot of things. while wating that this progress will finish, i want to see the progress in the progressBar.. How can i do it? thank you

    B Offline
    B Offline
    blackjack2150
    wrote on last edited by
    #3

    Put a ProgressBar on the form and modify the Value property according to the progress that it is being made. You'll have to calculate that as a percentage yourself. (assuming that you show it like x %)

    V 1 Reply Last reply
    0
    • P Pete OHanlon

      Add the progress bar component to the form that you want to show it on. Set the maximum value to the number of steps you need to perform, and increment the value by 1 after each step completes.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      A Offline
      A Offline
      Admin887
      wrote on last edited by
      #4

      DO you have any link that shows to me how to do it? thank you

      P 1 Reply Last reply
      0
      • A Admin887

        DO you have any link that shows to me how to do it? thank you

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #5

        Admin887 wrote:

        DO you have any link that shows to me how to do it?

        Really. Do I need to put a link on here for you? Why don't you try it out for yourself, as this is the best way to learn?

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        1 Reply Last reply
        0
        • P Pete OHanlon

          Add the progress bar component to the form that you want to show it on. Set the maximum value to the number of steps you need to perform, and increment the value by 1 after each step completes.

          Deja View - the feeling that you've seen this post before.

          My blog | My articles

          A Offline
          A Offline
          Admin887
          wrote on last edited by
          #6

          Thank you..it was very helpful.. :-D

          P 1 Reply Last reply
          0
          • A Admin887

            Thank you..it was very helpful.. :-D

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #7

            You're welcome.

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            1 Reply Last reply
            0
            • B blackjack2150

              Put a ProgressBar on the form and modify the Value property according to the progress that it is being made. You'll have to calculate that as a percentage yourself. (assuming that you show it like x %)

              V Offline
              V Offline
              V 0
              wrote on last edited by
              #8

              FYI you can set the maximum value so you don't need to calculate percentages. If you have 5 steps, set the Maximum to 5 and increment the value by 1.

              V.
              Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

              C 1 Reply Last reply
              0
              • A Admin887

                hello, i just want to know how can i create a Progressbar that represent the progress of a specific Form. i mean, i have a Form with a lot of steps..that caculate a lot of things. while wating that this progress will finish, i want to see the progress in the progressBar.. How can i do it? thank you

                L Offline
                L Offline
                lisan_al_ghaib
                wrote on last edited by
                #9

                If you have to do heavy calculation. A Better idea is to do it 'a part' in another thread. Use thread safe methods to update your progress bar

                A C 2 Replies Last reply
                0
                • L lisan_al_ghaib

                  If you have to do heavy calculation. A Better idea is to do it 'a part' in another thread. Use thread safe methods to update your progress bar

                  A Offline
                  A Offline
                  Admin887
                  wrote on last edited by
                  #10

                  Thank you!!! ;)

                  A 1 Reply Last reply
                  0
                  • A Admin887

                    Thank you!!! ;)

                    A Offline
                    A Offline
                    Abhijit Jana
                    wrote on last edited by
                    #11

                    you can use BackGroundWorker For that. becuase if you used progress bar for heavy operation your GUI will not respond becuase it give the priority to operation not GUI so your progress bar will not refresh. use BackGroundWorker Components in C#. that will help you.

                    cheers, Abhijit

                    A 1 Reply Last reply
                    0
                    • V V 0

                      FYI you can set the maximum value so you don't need to calculate percentages. If you have 5 steps, set the Maximum to 5 and increment the value by 1.

                      V.
                      Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                      C Offline
                      C Offline
                      chaiguy1337
                      wrote on last edited by
                      #12

                      You can calculate a percentage for textual output in addition to a progress bar (I think that's what blackjack meant) by dividing two doubles... of course you should know how to compute a percentage. Then you can use string functions to round that to a certain number of decimal points, but alas, I don't know the exact syntax.

                      “Time and space can be a bitch.” –Gushie, Quantum Leap {o,o}.oO( Looking for a great RSS reader? Try FeedBeast! ) |)””’)            Built with home-grown CodeProject components! -”-”-

                      V 1 Reply Last reply
                      0
                      • L lisan_al_ghaib

                        If you have to do heavy calculation. A Better idea is to do it 'a part' in another thread. Use thread safe methods to update your progress bar

                        C Offline
                        C Offline
                        chaiguy1337
                        wrote on last edited by
                        #13

                        I second that. Threads are always best for long-running background operations, just remember to perform control updates on the control thread, as lisan mentioned. Using threads will also allow you to have a "Cancel" button that can abort the background operation (if you periodically check for a canceled state in that thread, since actually aborting threads can be dangerous).

                        “Time and space can be a bitch.” –Gushie, Quantum Leap {o,o}.oO( Looking for a great RSS reader? Try FeedBeast! ) |)””’)            Built with home-grown CodeProject components! -”-”-

                        1 Reply Last reply
                        0
                        • C chaiguy1337

                          You can calculate a percentage for textual output in addition to a progress bar (I think that's what blackjack meant) by dividing two doubles... of course you should know how to compute a percentage. Then you can use string functions to round that to a certain number of decimal points, but alas, I don't know the exact syntax.

                          “Time and space can be a bitch.” –Gushie, Quantum Leap {o,o}.oO( Looking for a great RSS reader? Try FeedBeast! ) |)””’)            Built with home-grown CodeProject components! -”-”-

                          V Offline
                          V Offline
                          V 0
                          wrote on last edited by
                          #14

                          thanks for your reply, but I fail to see that it could be useful for me ;-)

                          V.
                          Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                          C 1 Reply Last reply
                          0
                          • V V 0

                            thanks for your reply, but I fail to see that it could be useful for me ;-)

                            V.
                            Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                            C Offline
                            C Offline
                            chaiguy1337
                            wrote on last edited by
                            #15

                            Well often a textual percentage is displayed on the progress dialog as well, or in its title bar so it can be seen on the task bar.

                            “Time and space can be a bitch.” –Gushie, Quantum Leap {o,o}.oO( Looking for a great RSS reader? Try FeedBeast! ) |)””’)            Built with home-grown CodeProject components! -”-”-

                            1 Reply Last reply
                            0
                            • A Abhijit Jana

                              you can use BackGroundWorker For that. becuase if you used progress bar for heavy operation your GUI will not respond becuase it give the priority to operation not GUI so your progress bar will not refresh. use BackGroundWorker Components in C#. that will help you.

                              cheers, Abhijit

                              A Offline
                              A Offline
                              Admin887
                              wrote on last edited by
                              #16

                              ooo thank you... it was very helpful!

                              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