I have read other posts about this but I still can't seem to get it to work right.

Whenever my BackgroundWorker begins to do work, my function **API.CheckForUpdate** causes the GUI to hang. I can't click on anything. It only freezes for half a second, but is enough to notice.

How can I fix this? Should I dive deeper into **API.CheckForUpdate** 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.

Also, I presume Form1\_Load is not the best place to put the RunWorkerAsync call. Where is a better spot?

```
'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

```