I added another form to my system tray application and in that form the user can perform an action that requires the program to reload itself
Problem is, I can't get the icon to disappear since the application is being exited from a form other than the main one that loaded the icon. If I exit the application from the main form, icon gets removed from the tray no problem.
How can I get rid of the icon when I exit the app from another form instance?
Code:
// Alert the user that the application will restart
MessageBox.Show("Settings Saved. Click OK to restart the application",
"Saved Settings", MessageBoxButtons.OK,
MessageBoxIcon.Stop);
// Shut down the current app instance
Application.Exit();
// Restart the app
System.Diagnostics.Process.Start(Application.ExecutablePath);
Problem is, I can't get the icon to disappear since the application is being exited from a form other than the main one that loaded the icon. If I exit the application from the main form, icon gets removed from the tray no problem.
How can I get rid of the icon when I exit the app from another form instance?