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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. custom progressbar, problem updating it.

custom progressbar, problem updating it.

Scheduled Pinned Locked Moved C#
questionhelpannouncement
3 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.
  • M Offline
    M Offline
    misterbear
    wrote on last edited by
    #1

    I've tried to create a custom progressbar to display while I'm doing some intensive work. I also want to update a string of what is currently going on, like an installer tells the user what file is currently being copied, and so on... So, I have a form that I display and then call methods like MyProgressForm.setProgressText(string) MyProgressForm.setProgress(int) but the GUI components (a label for the text and a custom-painted control for the progress) won't get updated, I guess because there is too much work going on... So my question is, how do I force these to be updated? What is the best way to solve this? thankful for some help, I can't seem to figure it out ...

    S T 2 Replies Last reply
    0
    • M misterbear

      I've tried to create a custom progressbar to display while I'm doing some intensive work. I also want to update a string of what is currently going on, like an installer tells the user what file is currently being copied, and so on... So, I have a form that I display and then call methods like MyProgressForm.setProgressText(string) MyProgressForm.setProgress(int) but the GUI components (a label for the text and a custom-painted control for the progress) won't get updated, I guess because there is too much work going on... So my question is, how do I force these to be updated? What is the best way to solve this? thankful for some help, I can't seem to figure it out ...

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      Calling the Update method of your ProgressBar after changing its Value or Text should solve the problem.


      www.troschuetz.de

      1 Reply Last reply
      0
      • M misterbear

        I've tried to create a custom progressbar to display while I'm doing some intensive work. I also want to update a string of what is currently going on, like an installer tells the user what file is currently being copied, and so on... So, I have a form that I display and then call methods like MyProgressForm.setProgressText(string) MyProgressForm.setProgress(int) but the GUI components (a label for the text and a custom-painted control for the progress) won't get updated, I guess because there is too much work going on... So my question is, how do I force these to be updated? What is the best way to solve this? thankful for some help, I can't seem to figure it out ...

        T Offline
        T Offline
        Tim Kohler
        wrote on last edited by
        #3

        You should be doing the lengthy processor intensive work in a thread seperate from the main gui thread. Start a worker thread and do your lengthy work there. Update the progress bar's values from the worker thread. The main window thread will then keep your bar painted properly.

        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