private void NewButtonClick(object sender, EventArgs e) { if (fd.modified) { switch (MessageBox.Show("This file not saved!!\n\nSave?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)) { case System.Windows.Forms.DialogResult.Yes: //Saving break; case System.Windows.Forms.DialogResult.No: break; case System.Windows.Forms.DialogResult.Cancel: return; } } //NewFile NewFile nf = new NewFile(); if (nf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { } }