title: VB.NET DownloadDataAsync:
body: <p>I am having the worst trouble getting around a bug, and am hoping that I can get some advice on this site. In short, I am trying to make an asynchronous web service call from my VB.NET application. But my "client_DownloadDataCompleted" callback is NEVER being called when the download is complete.</p>
  
  <p>Here is my complete code:</p>
  
  <pre><code>Public Sub BeginAsyncDownload(ByVal Url As String)
  
      Dim waiter As System.Threading.AutoResetEvent = New System.Threading.AutoResetEvent(False)
      Dim client As WebClient = New WebClient()
  
      'client_DownloadDataCompleted method gets called when the download completes.
      AddHandler client.DownloadDataCompleted, AddressOf client_DownloadDataCompleted
  
      Dim uri As Uri = New Uri(Url)
      Downloading = True  'Class variable defined elsewhere
      client.DownloadDataAsync(uri, waiter)
  
  End Sub
  
  Private Sub client_DownloadDataCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs)
      MessageBox.Show("Download Completed")
      Downloading = False
      Debug.Print("Downloaded")
  End Sub
  </code></pre>
  
  <p>Again, the client_DownloadDataCompleted method is never being called. I have also tried using the method: </p>
  
  <pre><code>Private Sub client_DownloadDataCompleted(ByVal sender As Object, ByVal e As DownloadDataCompletedEventArgs)
  </code></pre>
  
  <p>With no luck.  What I really need is that "Downloading" variable to be switched off when the download is complete.</p>
  
  <p>Thanks in advance!
  Brett</p>