ProgressBar Status

    Date: 04/26/07 (C Sharp)    Keywords: no keywords

    I'm still pretty new to C#. How do I implement the following to work correctly (the status is updated)? I want to show an accurate percentage of the progress bar. Ignore the extra figures after the decimal point.

            private void button1_Click(object sender, EventArgs e)
            {
                timer1.Start();
                button1.Enabled = false;
            }
    
            private void timer1_Tick(object sender, EventArgs e)
            {
                if (progressBar1.Value == progressBar1.Maximum)
                {
                    timer1.Stop();
                    button1.Enabled = true;
                    label3.Text = "100%";
                    return;
                }
                progressBar1.PerformStep();
                double x = (progressBar1.Value/progressBar1.Maximum) * 100.0;
                label3.Text = String.Format("{0}%", x);
    
            }
    

    Thanks!

    Source: http://community.livejournal.com/csharp/84502.html

« Porting from C++ to C++/CLI... || Composite Controls »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home