Introduction
Some time when you download a file from the internet using webclient we need to show progress bar to the user indicating how much task is accomplished. This can be very difficult and cumbersome when using Webclient.DownloadFile() method because it freeze the interface and we need to do extra coding by thread to show progress bar.
Here I am going to show you how to do that task very simply.
Technologies : .NET 2.0/3.5
Language : C#
Prerequisite :
-
.NET Framework 3.5/2.0
-
Visual Studio 2008/2005
Implementation
Lets get started, fist of all let setup the GUI like below:
Take a label, Text Box, Progress bar and a Button.
Now in code first of all define the namespace we are going to use
using System.IO;
using System.Net;
Now on the Click Event of the Button write code like below
private void btnDownload_Click(object sender, EventArgs e)
{
WebClient wc = new WebClient();
wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged);
wc.DownloadFileAsync(new Uri(textBox1.Text.Trim()), @"c:\Users\Kirtan\Desktop\" + "Downloaded." + Path.GetExtension(textBox1.Text));
}

Akarsh RaoPosted Jun 24, 2020, 4:02 AM
Can u help with file upload control for uploading files with progress bar?