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?????


VulpesRank #55 · 29.2K reputationPosted Jul 11, 2012, 8:22 AM EDT
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.
VulpesRank #55 · 29.2K reputationPosted Jul 11, 2012, 7:59 AM EDT
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
}
}
divya146 reputationPosted Jul 11, 2012, 8:11 AM EDT
divya146 reputationPosted Jul 11, 2012, 8:31 AM EDT