Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
My ProgressBar is starting late, when I try to download BIG file (600MB).
For Small files its okay.
C#
private void Form_Load()
{
    backGroundWorker.RunWorkerAsync();
    Count();
    Download();
}

Count()
{
    count++;
    //Files count
}

Download()
{
    download++;
    //File Download
}
private void backGroundWorker_Dowork()
{
    int percents=((download*100)/count);
    backGroundWorker.ReportProgress(percents,download);
}
Posted
v2
Comments
stibee 4-May-13 4:44am    
How many files? How do you download? FTP? I did somethings like this once. I had also the information of the downloaded bytes for each file.
Maybe you make two progressbar:
- First progressbar where you see progress of each files (downloaded bytes of total bytes of one file)
- Second progressbar where you progress (files downloaded from)

Your approach has the bad affect, that if you download 100 files and the first ist 100MB and the rest is only 1MB, you will wait long for the first file.
Friendsaa 4-May-13 6:45am    
Yes, I am downloading using FTPwebrequest, First file is 600Mb, which is taking too much time.
then all small files are going fine, How can i show progress for each file (downloaded bytes of total bytes of one file)
stibee 4-May-13 9:09am    
I used http://www.enterprisedt.com/products/edtftpnet/overview.html

Do you implement the request like http://www.codeproject.com/Tips/443588/Simple-Csharp-FTP-Class?

Maybe an approach is to work with events, but I'm not shure if there is a better way.

1 solution

C#
private void Form_Load()
{
    this.Show();
    Count();
    progressBar1.Maximum=cnt;
    progressBar1.Minimum=1;
    progressBar1.Step=dnld;
    Download();
}

Count()
{
    cnt++;
    //Files count
}

Download()
{
    dnld++;
    progressBar1.PerfomStep();
    //File Download
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900