?
Solved

Progress Bar

Posted on 2006-05-18
8
Medium Priority
?
262 Views
Last Modified: 2010-04-17
I have written a code that takes 65 minutes to execute in my System for 30,000 Iterations. I want to add a dynamic Progress Bar For this code.

My code looks Like this


Public void method1()
{
    for(int i=0;i<30000;i++)
    {
        //Do Somthing
    }
    MyClas obj = new MyClass()
    obj.method2();
}

Public void method2()
{
    for(int i=0;i<30000;i++)
    {
        //Do Somthing
    }
}

Please let me know how to add a dynamic progress bar for this code??.(The Processing time is depending on the System resources)
0
Comment
Question by:sree032397
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:vb_jonas
ID: 16708619
You will have to let it run for one second or so and see how long it took, and after that scale the progress bar.
0
 
LVL 12

Expert Comment

by:vb_jonas
ID: 16708631
*delete/ignore my answe pls*
0
 
LVL 25

Expert Comment

by:InteractiveMind
ID: 16709649
At the end of each iteration, increments the width of the progress bar by (width_of_bar * i / 30000).
0
 
LVL 25

Accepted Solution

by:
InteractiveMind earned 1000 total points
ID: 16709659
Sorry, you wouldn't _increment_ by that amount; instead, that would become the _new_ width of the bar.

(Or you could just increment by width_of_bar/30000 -- but I really would not recommend this).
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 1000 total points
ID: 16710110
Or leave the width at say 100 and then calculate what percentage you are currently at:
 
    percentage = i/30000*100 ' take the Integer value

Then use that value to set your progressbar.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question