how can i control the close button in a form....
(the three bottons minimize,maxi,close for all windows form)
i hav attached a fig... jst check it...
n pls reply
bk_bhupendra
-2
Newbie Poster
Recommended Answers
Jump to PostYou can handle the close event on the form using the following event handler:
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult.No == MessageBox.Show("Exit without saving changes?", "Data Not Saved", MessageBoxButtons.YesNo)) e.Cancel = true; }
The above event will be called whenever the
Close()
method …
Jump to PostYou can also add the event handler directly in your form's constructor in the form of:
public Form1() { InitializeComponent(); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); }
All 5 Replies
DdoubleD
315
Posting Shark
bk_bhupendra
-2
Newbie Poster
Geekitygeek
480
Nearly a Posting Virtuoso
DdoubleD
315
Posting Shark
Diamonddrake
397
Master Poster
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.