Hi,

I'm building an application which places an icon in the system tray.

In the Form Unload(Cancel As Integer) event I am calling the function to remove the icon:

Cancel = True
sysMain.RemoveFromTray
Unload Me

This works fine until the application is ended by another means i.e. through Task Manager or by the SCADA system the application is being developed to compliment.

Is there somewhere I can call my RemoveFromTray procedure from in order to remove the icon from the tray when the application is ended rather than when the form is unloaded.

Any suggestions would be greatly appreciated.

Best regards,

Rob Brown.