'How to cancel application exit from TaskBar in .Net

Is there a way to prevent application exit, or at least ask "Are you sure?" with a messagebox, when a user right clicks on the TaskBar on the application icon and then click the Close Window?

As far as I understand this generates an event Application.Exit which is not cancellable. Any way around this?

Thanks for the help :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source