如何在使用c#关闭表单之前显示弹出消息 [英] how to show the pop up message before the closing the form using c#
本文介绍了如何在使用c#关闭表单之前显示弹出消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在使用c sharp关闭屏幕之前显示弹出消息。
我该怎么办?
请帮帮我。
问候,
Narasiman P.
i want to show the pop up message before closing the screen using c sharp.
for that how can i do?
please help me.
Regards,
Narasiman P.
推荐答案
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
MessageBox.Show ("Closing...");
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if(MessageBox.Show("Are you sure you want to exit?", "My Application",MessageBoxButtons.YesNo) == DialogResult.Yes)
{
// Cancel the Closing event from closing the form.
e.Cancel = true;
}
}
这篇关于如何在使用c#关闭表单之前显示弹出消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文