Closing form taking user confirmation in windows

Posted by Satyapriyanayak under C# category on | Points: 40 | Views : 1094
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication5
public partial class Form6 : Form
public Form6()

private void Form6_FormClosing(object sender, FormClosingEventArgs e)
DialogResult dr = MessageBox.Show("Are you sure you want to close this form?", "Confirmation of Form Closure", MessageBoxButtons.YesNo);
if (dr == DialogResult.No) e.Cancel = true;


Comments or Responses

Login to post response