Hi all, I m using C# from Quite some time. I m facing a problem regarding my project. The problem is
When the user clicks on the close button on any form it displays the messagebox saying Do u really want to quit or not?. This MessageBox contains two buttons Yes And No. Now the Problem is If a user clicks on the Yes button The form must get closed whick is quite simple. But.... when a user clicks on the No button then the form must not closed. I dont have any idea how to stop the closed form event.
thanks in advance for any suggestions
Gaurav arora
0
Junior Poster in Training
Recommended Answers
Jump to Postprivate void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if ((Interaction.MsgBox("Are you sure want to quit?", MsgBoxStyle.YesNo, "Exit")) == MsgBoxResult.Yes) { ProjectData.EndApp(); } else { e.Cancel = true; } }
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.