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. progressBar [modified]

progressBar [modified]

Scheduled Pinned Locked Moved C#
question
6 Posts 5 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.
  • E Offline
    E Offline
    erfi
    wrote on last edited by
    #1

    I used a progressbar in my form and want to show it's value on a lable by this code :

    for(i=0;i<100;i++)
    {
    for(j=0;j<100;j++)
    {
    // DO ...
    }
    progressbar.value = i;
    lable.Text = i.tostring()+"%";
    }

    but lable's text doesn't change in progress and just in the end of loop(i) shows the 100%. any suggestion? thanks. erfan -- modified at 7:42 Tuesday 18th July, 2006

    A E 2 Replies Last reply
    0
    • E erfi

      I used a progressbar in my form and want to show it's value on a lable by this code :

      for(i=0;i<100;i++)
      {
      for(j=0;j<100;j++)
      {
      // DO ...
      }
      progressbar.value = i;
      lable.Text = i.tostring()+"%";
      }

      but lable's text doesn't change in progress and just in the end of loop(i) shows the 100%. any suggestion? thanks. erfan -- modified at 7:42 Tuesday 18th July, 2006

      A Offline
      A Offline
      alexey N
      wrote on last edited by
      #2

      Try to run your procedure in other thread. This article will help you to do it. My english is not so good. Please, correct my errors. Best regards, Alexey.

      S 1 Reply Last reply
      0
      • A alexey N

        Try to run your procedure in other thread. This article will help you to do it. My english is not so good. Please, correct my errors. Best regards, Alexey.

        S Offline
        S Offline
        SeMartens
        wrote on last edited by
        #3

        Hi, just a short hint. Maybe it is not the best possibilty (running an own thread is much better), but try to use Application.DoEvents() after you reset the text of the label to its new value. Regards Sebastian

        1 Reply Last reply
        0
        • E erfi

          I used a progressbar in my form and want to show it's value on a lable by this code :

          for(i=0;i<100;i++)
          {
          for(j=0;j<100;j++)
          {
          // DO ...
          }
          progressbar.value = i;
          lable.Text = i.tostring()+"%";
          }

          but lable's text doesn't change in progress and just in the end of loop(i) shows the 100%. any suggestion? thanks. erfan -- modified at 7:42 Tuesday 18th July, 2006

          E Offline
          E Offline
          engsrini
          wrote on last edited by
          #4

          This is due to UI doesn't get time redraw its area do this lable.Text = i.tostring()+"%"; this.Refresh();

          M 1 Reply Last reply
          0
          • E engsrini

            This is due to UI doesn't get time redraw its area do this lable.Text = i.tostring()+"%"; this.Refresh();

            M Offline
            M Offline
            mabo42
            wrote on last edited by
            #5

            It is enough to refresh the label.

            label.Text = i.ToString() + "%";
            label.Refresh();

            E 1 Reply Last reply
            0
            • M mabo42

              It is enough to refresh the label.

              label.Text = i.ToString() + "%";
              label.Refresh();

              E Offline
              E Offline
              erfi
              wrote on last edited by
              #6

              thanks. this is working. erfan

              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