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

progressBar

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

    HI I have written a function(ReadByte)that read a file in class library. and make a add refrence to window application. i place a button control and a progressBar on the form and at the button click event i call ReadByte function now i want that progressBar should be progressed as file is reading . How can i do this

    C 1 Reply Last reply
    0
    • P Parshant Verma

      HI I have written a function(ReadByte)that read a file in class library. and make a add refrence to window application. i place a button control and a progressBar on the form and at the button click event i call ReadByte function now i want that progressBar should be progressed as file is reading . How can i do this

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      If you're reading one byte at a time, your progress bar will work, at the cost of the operation being slow. You can call Application.DoEvents to make your form repaint, or put the byte reading code in another thread to your UI.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      P 1 Reply Last reply
      0
      • C Christian Graus

        If you're reading one byte at a time, your progress bar will work, at the cost of the operation being slow. You can call Application.DoEvents to make your form repaint, or put the byte reading code in another thread to your UI.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        P Offline
        P Offline
        Parshant Verma
        wrote on last edited by
        #3

        sir i want to know how the progress bar will progress while it is in window appl. how can i kow how many bytes are read. is there any ParameterizedThread function or like this in c#1.1

        J 1 Reply Last reply
        0
        • P Parshant Verma

          sir i want to know how the progress bar will progress while it is in window appl. how can i kow how many bytes are read. is there any ParameterizedThread function or like this in c#1.1

          J Offline
          J Offline
          jeyapandian
          wrote on last edited by
          #4

          i think the easy way is fire event from reading loop and catch in the progressbar form and change the indicator according to that. i customised the EventArgs with TotBytes and TotRead. it is working for me. good luck

          Where there is a will,there is a way.

          P 1 Reply Last reply
          0
          • J jeyapandian

            i think the easy way is fire event from reading loop and catch in the progressbar form and change the indicator according to that. i customised the EventArgs with TotBytes and TotRead. it is working for me. good luck

            Where there is a will,there is a way.

            P Offline
            P Offline
            Parshant Verma
            wrote on last edited by
            #5

            that is the problem how can i read loop in class library that notify me what is the status

            C 1 Reply Last reply
            0
            • P Parshant Verma

              that is the problem how can i read loop in class library that notify me what is the status

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              You can create a delegate which calls out of the class library on every iteration.

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

              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