title: Download files with C# Windows Forms and webclient
body: <p>I am learning how to use http requests and webclient in C# windows forms. Currently I have gotten the following code from <a href="https://stackoverflow.com/questions/6773866/download-file-and-automatically-save-it-to-folder">Example</a> and I am trying to make it work as well as understand it.</p>
  
  <p>The code executes successfully and displays the messagebox "Download Complete" box but it does not actually download the file. Would someone explain to me how this works and what I am doing wrong?</p>
  
  <pre><code>    private void btnDownload_Click(object sender, EventArgs e)
      {
          string filepath = txtBxSaveTo.Text.ToString();
          WebClient webClient = new WebClient();
          webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
          webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
          webClient.DownloadFileAsync(new Uri("http://download.thinkbroadband.com/10MB.zip"), filepath);
      }
  
      private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
      {
          progressBar.Value = e.ProgressPercentage;
      }
  
      private void Completed(object sender, AsyncCompletedEventArgs e)
      {
          MessageBox.Show("Download completed!");
      }
  
      private void btnSavetoLocation_Click(object sender, EventArgs e)
      {
          FolderBrowserDialog selectedFolder = new FolderBrowserDialog();
  
          if (selectedFolder.ShowDialog() == DialogResult.OK)
          {
              txtBxSaveTo.Text = selectedFolder.SelectedPath;
  
          }
      }
  }
  </code></pre>
  
  <p>}</p>