Link to home
Start Free TrialLog in
Avatar of sree032397
sree032397

asked on

Progress Bar

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)
Avatar of vb_jonas
vb_jonas
Flag of Sweden image

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.
*delete/ignore my answe pls*
At the end of each iteration, increments the width of the progress bar by (width_of_bar * i / 30000).
ASKER CERTIFIED SOLUTION
Avatar of InteractiveMind
InteractiveMind
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial