Trouble with Progress bar

C++, C#, Java, PHP, ect...
Post Reply
crzyone9584
Posts: 116
Joined: Mon Aug 01, 2011 4:46 am

Trouble with Progress bar

Post by crzyone9584 »

I'm attempting to get the lblPercent.Text to show. It wont show till after that last file is unzipped. Also the progress bar won't fill all the way? Am i missing something here?

Code: Select all

public void Install()
        {
            string[] filePaths = Directory.GetFiles(Application.StartupPath, "*.zip");

            FastZip fastZip = new FastZip();
            string fileFilter = null;

            foreach (string s in filePaths)
            {
                pbInstaller.Value = 0;
                lblInstalling.Text = "Installing: " + 0 + "%";
                //Thread.Sleep(50); // Make it look like its finding more things to install
                // will always overwrite if target filenames already exist
                fastZip.ExtractZip(s, Application.StartupPath, fileFilter);

                for (int i = 0; i <= 100; i++)
                {
                    lblPercent.Text = "Installing: " + i + "%";
                    pbInstaller.Value = i;
                    Thread.Sleep(50); // Slow it down a little
                    if (i == 100)
                    {
                        pbInstaller.Value = 100;
                        lblPercent.Text = "Installing: " + 100 + "%";
                        Thread.Sleep(50); // Simulate waite while new zip gets ready
                    }

                }
            }
        }
Imagecrzy
Male Ninja
Str: 5 Agi: 17 Fort: 5 IQ: 5
HP: 10/10 MP: 5/5
See Full Character:
Post Reply

Return to “Coding”