This is my first application I have written in vb.net, having learnt to program in VBA and vb5 - so go easy.
I have written a program which involves a BackgroundWorker and a NotifyIcon.
I have 'disabled' the close button by using the following code:
and then in a context menu item on the notifyicon I have code where the application really closes.
I have tried a whole host of things to get the application to fully exit, but the process is still running in task manager. I believe it might have something to do with the BackgroundWorker, and you can see my attempts below to stop it:
Any advice would be gratefully received.
Joe
I have written a program which involves a BackgroundWorker and a NotifyIcon.
I have 'disabled' the close button by using the following code:
VB.NET:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles Me.FormClosing
Me.WindowState = FormWindowState.Minimized
Me.Visible = False
e.Cancel = True
End Sub
and then in a context menu item on the notifyicon I have code where the application really closes.
I have tried a whole host of things to get the application to fully exit, but the process is still running in task manager. I believe it might have something to do with the BackgroundWorker, and you can see my attempts below to stop it:
VB.NET:
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
NotifyIcon1.Dispose()
Application.DoEvents()
BackgroundWorker1.CancelAsync()
BackgroundWorker1.Dispose()
Me.Close()
Application.Exit()
End Sub
Any advice would be gratefully received.
Joe