G Guest Oct 9, 2005 #1 i have form i need when user Close the form a messagebox confirm him with Yes or No if yes exist if no stay....how can i achieve this?
i have form i need when user Close the form a messagebox confirm him with Yes or No if yes exist if no stay....how can i achieve this?
C Cor Ligthert [MVP] Oct 9, 2005 #2 Raed, Have a look at this page, it tells in my opinion everything you want to know about your problem. http://msdn.microsoft.com/library/d...rfsystemwindowsformsformclassclosingtopic.asp I hope this helps, Cor
Raed, Have a look at this page, it tells in my opinion everything you want to know about your problem. http://msdn.microsoft.com/library/d...rfsystemwindowsformsformclassclosingtopic.asp I hope this helps, Cor
B Billy Porter Oct 9, 2005 #3 Hi, Here you go: protected override void OnClosing(CancelEventArgs e) { DialogResult result = MessageBox.Show("Really close?", "Confirm exit", MessageBoxButtons.OKCancel); e.Cancel = result == DialogResult.Cancel; } HTH, Billy
Hi, Here you go: protected override void OnClosing(CancelEventArgs e) { DialogResult result = MessageBox.Show("Really close?", "Confirm exit", MessageBoxButtons.OKCancel); e.Cancel = result == DialogResult.Cancel; } HTH, Billy