消息对话框的返回值是System.Windows.Forms.DialogResult的成员,各枚举常量及意义如下表
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
使用:
1、 /* if (flag)
{
DialogResult diagorel = MessageBox.Show(this, "Please inpult again,your message is empty!", "Information cue", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
switch (diagorel)
{
case DialogResult.Retry:
this.username.Text = "";
this.password.Text = "";
break;
case DialogResult.Cancel:
break;
}
}*/
2、最简单的方法就是这样
if( MessageBox.Show( "确定提交吗?", "提示", MessageBoxButtons.YesNo ) == DialogResult.Yes )
{
程序运行代码.......
}
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
注:相关教程知识阅读请移步到c#教程频道。










