title: Threading functions with VB.net
body: <p>I'm trying to thread my functions so the main GUI of my application doesn't fail to respond while the tasks are running.</p>
  
  <p>At the moment my form1.vb is something like this.  I've cut it down as to reduce the text, but everything works fine:</p>
  
  <pre><code>Public Class MAIR
  
  Private Sub InstallTheAgent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InstallTheAgent.Click
      InstallAgentWorker.RunWorkerAsync()
  End Sub
  
  Private Sub InstallAgentWorker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles InstallAgentWorker.DoWork
  'Do some stuff
  End Sub
  
  Private Sub InstallAgentWorker_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles InstallAgentWorker.RunWorkerCompleted
      ' Called when the BackgroundWorker is completed.
      MsgBox("Installation of the Agent Complete")
      ProgressBar1.Value = 0
  End Sub
  
  End Class
  </code></pre>
  
  <p>From my understanding, when the button "Open" is pressed, it calls the function Install and it should start this off in a separate thread, however this doesn't work.</p>
  
  <p>This seems to work, but the GUI still locks up, suggesting its not in a separate thread</p>