private void btnClose_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are You Sure To Close ?", "Close", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
this.Close();
}
}
And In form properties i changed cancleButton to btnClose...
can any one help me?????
And In form properties i changed cancleButton to btnClose...
can any one help me?????

VulpesPosted Jul 11, 2012, 12:22 PM
then the FormClosing event should fire automatically when the user clicks the Close button, presses Escape or the 'X' button and (s)he will then have an opportunity to cancel the closure if it's a mistake.
divyaPosted Jul 11, 2012, 12:31 PM
divyaPosted Jul 11, 2012, 12:11 PM
VulpesPosted Jul 11, 2012, 11:59 AM
private void Form1_FormClosing(Object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("Are You Sure To Close ?", "Close", MessageBoxButtons.YesNo) == DialogResult.No)
{
e.Cancel = true; // prevents closure
}
}