progressbar

C# Download File with Progress Bar

The following is a snippet of code to download a file in a Windows Forms application using C# and the System.Net.WebClient object. This code also updates a progress bar as the file is downloaded.

First, create a new windows forms application with C# as the target language. (NOTE: This works in any .NET framework version). Add a ProgressBar to the form and a BackgroundWorker control. Also add a Button to the form. The form will look something like this:

windows form application

Recent comments