Hi,
My program has 'applets', so to speak, so I use a string called AppQueue to tell the BackgroundWorker what to do.
I'm using the BackgroundWorker control to open new forms in the background (keeping the main application form responsive) as some of them take a long time to load.
I call
FormName.Show() (where
FormName is the form's name) in the RunWorkerCompleted event, but the entire application freezes until the forms show. If I use the DoWork event, the form that I want to open freezes and cannot be used, while the rest of the application continues to respond. I read a tutorial that said to use the RunWorkerCompleted event, but it's not working and instead causes the entire application to freeze until the form that's in the AppQueue string loads.
Here's the code:
Private Sub BkgApps_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BkgApps.RunWorkerCompleted
If AppQueue = "Prefs" Then
Prefs.Show()
Prefs.Focus()
Prefs.BringToFront()
Prefs.WindowState = FormWindowState.Normal
ElseIf AppQueue = "Calendar" Then
cal.Show()
cal.Focus()
cal.BringToFront()
cal.WindowState = FormWindowState.Normal
End If
If there's anything I can do to improve the question please let me know.
Thanks.