Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I wish that user gets a warning when Close button is pressed.
I can put the warning message in _FormClosing event but I donot know how to stop closing if user choses to stop it.


Thanks
Furqan
Posted

1 solution

Check out this link :

http://msdn.microsoft.com/en-us/library/system.windows.window.closing.aspx[^]

Basically, you can set e.Cancel = true to cancel the closing and vice-versa.
Hope it helped.
 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 25-Apr-11 4:12am    
Correct! 5+
Tarun.K.S 25-Apr-11 4:24am    
Thanks! :)
Pravin Patil, Mumbai 25-Apr-11 4:12am    
My 5........
Tarun.K.S 25-Apr-11 4:24am    
Thanks! :)
Sergey Alexandrovich Kryukov 25-Apr-11 4:12am    
Correct, a 5. OP can also hide instead of closing via the method you suggest.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900