title: BackgroundWorker freezes GUI
body: <p>I have read other posts about this but I still can't seem to get it to work right.</p>
  
  <p>Whenever my BackgroundWorker begins to do work, my function <strong>API.CheckForUpdate</strong> causes the GUI to hang.  I can't click on anything.  It only freezes for half a second, but is enough to notice.</p>
  
  <p>How can I fix this?  Should I dive deeper into <strong>API.CheckForUpdate</strong> and run individual threads on particular statements, or can I just have an all-inclusive thread that handles this?  API.CheckForUpdate does not reference anything in Form1.</p>
  
  <p>Also, I presume Form1_Load is not the best place to put the RunWorkerAsync call.  Where is a better spot?</p>
  
  <pre><code>'Declarations
  Dim ApplicationUpdate As BackgroundWorker = New BackgroundWorker
  
  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      ApplicationUpdate.WorkerSupportsCancellation = True
      ApplicationUpdate.WorkerReportsProgress = True
      AddHandler ApplicationUpdate.DoWork, AddressOf ApplicationUpdate_DoWork
      AddHandler ApplicationUpdate.ProgressChanged, AddressOf ApplicationUpdate_ProgressChanged
      AddHandler ApplicationUpdate.RunWorkerCompleted, AddressOf ApplicationUpdate_RunWorkerCompleted
      ApplicationUpdate.RunWorkerAsync()
  End Sub
  
  Private Sub ApplicationUpdate_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
      'Check for an update (get the latest version)
      Dim LatestVersion = API.CheckForUpdate
  End Sub
  
  Private Sub ApplicationUpdate_ProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs)
      'Nothing here
  End Sub
  
  Private Sub ApplicationUpdate_RunWorkerCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs)
      'Work completed
      MsgBox("Done")
  End Sub
  </code></pre>