Page 1 of 1

Trouble with Progress bar

Posted: Wed Jan 25, 2012 6:30 pm
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
                    }

                }
            }
        }