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. Thread and problem

Thread and problem

Scheduled Pinned Locked Moved C#
helptutorialquestion
4 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.
  • P Offline
    P Offline
    papa1980
    wrote on last edited by
    #1

    hi I have one threat for calculating but i need some progress bar to do visualisation of step of calculation how to do that??? good bye best regards

    L 1 Reply Last reply
    0
    • P papa1980

      hi I have one threat for calculating but i need some progress bar to do visualisation of step of calculation how to do that??? good bye best regards

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Look in the C# Windows Forms / C# Controls menu here at CodeProject. There is an entire section on Progress Controls.

      "What classes are you using ? You shouldn't call stuff if you have no idea what it does"
      Christian Graus in the C# forum

      led mike

      P 1 Reply Last reply
      0
      • L led mike

        Look in the C# Windows Forms / C# Controls menu here at CodeProject. There is an entire section on Progress Controls.

        "What classes are you using ? You shouldn't call stuff if you have no idea what it does"
        Christian Graus in the C# forum

        led mike

        P Offline
        P Offline
        papa1980
        wrote on last edited by
        #3

        I knoe it how to inset progrss bar in normal program but how to do it in thread???

        M 1 Reply Last reply
        0
        • P papa1980

          I knoe it how to inset progrss bar in normal program but how to do it in thread???

          M Offline
          M Offline
          mav northwind
          wrote on last edited by
          #4

          You have to tell the ProgressBar to update, but be careful not to directly access UI elements from a different thread than the one they were created in. So you should define a delegate, for example

          private delegate void SetProgressValueDelegate(int val);

          and a method in your class to update the ProgressBar (its signature must match the delegate):

          private void SetProgressValue(int val)
          {
          progressBar1.Value = val;
          }

          Then you can safely invoke the method from your thread by calling:

          Invoke(new SetProgressValueDelegate(SetProgressValue), new object[] { newValue });

          where newValue is the value to set the ProgressBar to. Regards, mav -- Black holes are the places where god divided by 0...

          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