Progress bar step

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alan T

    #1

    Progress bar step

    Sometimes I have to loop thru' 55 times, sometimes 240 times.

    How do I set the Maximum and, Step property of progress bar so that it
    reflects the progress inside the while loop?

    i = 55;

    for (int x= 0; x < i; x++)
    {
    .....
    ProgressBar1.Pe rformStep().
    }


  • Daniel

    #2
    Re: Progress bar step

    //doing property names from top of my head so use common sense and set to
    what i obviously mean
    // also i am assuming your step is set at 1

    ProgressBar1.Ma x = 55;

    i = 55;

    for (int x= 0; x < i; x++)
    {
    if(ProgressBar1 .Value < ProgressBar1.Ma x)
    ProgressBar1.Pe rformStep().
    }

    That would step by 1 every iteration and on the value equaling the max the
    bar would stop.

    Why are you doing it this way anyway? This just for testing it?

    Remember fire your progress bar on a new thread to measure whatever it is
    that is loading and so on so that it doesn't block your processing thread of
    data that it is measuring.

    Hope that helps, difficult to know how much use it is when the code above
    would only be useful for testing and experimenting with how a progress bar
    works.


    "Alan T" <alanpltseNOSPA M@yahoo.com.auw rote in message
    news:OwgEb%23k8 GHA.3644@TK2MSF TNGP03.phx.gbl. ..
    Sometimes I have to loop thru' 55 times, sometimes 240 times.
    >
    How do I set the Maximum and, Step property of progress bar so that it
    reflects the progress inside the while loop?
    >
    i = 55;
    >
    for (int x= 0; x < i; x++)
    {
    .....
    ProgressBar1.Pe rformStep().
    }
    >

    Comment

    • Alan T

      #3
      Re: Progress bar step

      What I am doing is to process files in a directory as input parameter so the
      number of files will be different depends on the directory.
      I need to reflect the progress to the user of how many files have been
      processed.

      "Daniel" <DanielV@vestry online.comwrote in message
      news:OxVziLl8GH A.3916@TK2MSFTN GP04.phx.gbl...
      //doing property names from top of my head so use common sense and set to
      what i obviously mean
      // also i am assuming your step is set at 1
      >
      ProgressBar1.Ma x = 55;
      >
      i = 55;
      >
      for (int x= 0; x < i; x++)
      {
      if(ProgressBar1 .Value < ProgressBar1.Ma x)
      ProgressBar1.Pe rformStep().
      }
      >
      That would step by 1 every iteration and on the value equaling the max the
      bar would stop.
      >
      Why are you doing it this way anyway? This just for testing it?
      >
      Remember fire your progress bar on a new thread to measure whatever it is
      that is loading and so on so that it doesn't block your processing thread
      of data that it is measuring.
      >
      Hope that helps, difficult to know how much use it is when the code above
      would only be useful for testing and experimenting with how a progress bar
      works.
      >
      >
      "Alan T" <alanpltseNOSPA M@yahoo.com.auw rote in message
      news:OwgEb%23k8 GHA.3644@TK2MSF TNGP03.phx.gbl. ..
      >Sometimes I have to loop thru' 55 times, sometimes 240 times.
      >>
      >How do I set the Maximum and, Step property of progress bar so that it
      >reflects the progress inside the while loop?
      >>
      >i = 55;
      >>
      >for (int x= 0; x < i; x++)
      >{
      > .....
      > ProgressBar1.Pe rformStep().
      >}
      >>
      >
      >

      Comment

      • Daniel

        #4
        Re: Progress bar step

        I see

        In that case you set the progressbar.max to how many files you are
        expecting.
        Set the stepvalue to 1

        and then as you process each do the if statement i gave you before. Once you
        process them all your prgressbar will be at 100%. Process file, update
        progressbar etc until done

        "Alan T" <alanpltseNOSPA M@yahoo.com.auw rote in message
        news:uYrxWkm8GH A.4996@TK2MSFTN GP03.phx.gbl...
        What I am doing is to process files in a directory as input parameter so
        the number of files will be different depends on the directory.
        I need to reflect the progress to the user of how many files have been
        processed.
        >
        "Daniel" <DanielV@vestry online.comwrote in message
        news:OxVziLl8GH A.3916@TK2MSFTN GP04.phx.gbl...
        >//doing property names from top of my head so use common sense and set to
        >what i obviously mean
        >// also i am assuming your step is set at 1
        >>
        >ProgressBar1.M ax = 55;
        >>
        >i = 55;
        >>
        >for (int x= 0; x < i; x++)
        >{
        > if(ProgressBar1 .Value < ProgressBar1.Ma x)
        > ProgressBar1.Pe rformStep().
        >}
        >>
        >That would step by 1 every iteration and on the value equaling the max
        >the bar would stop.
        >>
        >Why are you doing it this way anyway? This just for testing it?
        >>
        >Remember fire your progress bar on a new thread to measure whatever it is
        >that is loading and so on so that it doesn't block your processing thread
        >of data that it is measuring.
        >>
        >Hope that helps, difficult to know how much use it is when the code above
        >would only be useful for testing and experimenting with how a progress
        >bar works.
        >>
        >>
        >"Alan T" <alanpltseNOSPA M@yahoo.com.auw rote in message
        >news:OwgEb%23k 8GHA.3644@TK2MS FTNGP03.phx.gbl ...
        >>Sometimes I have to loop thru' 55 times, sometimes 240 times.
        >>>
        >>How do I set the Maximum and, Step property of progress bar so that it
        >>reflects the progress inside the while loop?
        >>>
        >>i = 55;
        >>>
        >>for (int x= 0; x < i; x++)
        >>{
        >> .....
        >> ProgressBar1.Pe rformStep().
        >>}
        >>>
        >>
        >>
        >
        >

        Comment

        Working...