Hi,
I have a notify icon in my system tray and all works well but when i go to shutdown my machine it does nothing.

When I close down the program from the system tray then shutdown its shuts down as normal.

is there any bit of code i could use to close the program when windows shut's down.

i'm using this code but it doesn't seem to work.

Private Sub FaultReport_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If frmclose = True Then
Else
If Microsoft.Win32.SessionEndReasons.SystemShutdown = True Then
Me.Close()
Else
Me.Hide()
e.Cancel = True
End If

End If

End Sub


Private Sub MnuClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MnuClose.Click
frmclose = True

Me.Close()

End Sub