简体   繁体   中英

C# Ftp DownloadFiles Progress

I downloaded ftp.dll and I'm using it. I used that code :

ftp.DownloadFiles(Properties.Settings.Default.update_ver,
Application.StartupPath,
new RemoteSearchOptions("*.*", true));

But I want use progress bar which shows progress of download.

There is link for download : http://www.limilabs.com/ftp

Thanks for helps.

I believe that I have solved your problem. Here are a few steps to fix it:

STEP 1: Add Background Worker.

STEP 2: Set WorkerReportsProgress to True at Properties.

STEP 3: Add backgroundWorker1.RunWorkerAsync(); to form load.

STEP 4: Double Click Background Worker

STEP 5: Add your codes here... Add this code to end of your code :

for (int i = 0; i <= 100; i++)
{
     backgroundWorker1.ReportProgress(i);
     // You can remove Sleeep. I added because my download is realy fast.
     System.Threading.Thread.Sleep(20);
}

STEP 6: Click Events at Properties.

STEP 7: Double click Progress Changed

STEP 8: Add Statusbar1.Value = e.ProgressPercentage;

STEP 9: Double click RunWorkerCompleted

STEP 10: Add your code for finished downloaded.

I hope this will help to everyone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM