最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】C#中如何获得MessageBox的返回值

C# crifan 2943浏览 0评论

【背景】

C#中想要获得MessageBox的返回值

【解决过程】

1.参考这里知道了对应的用法,即使用一个DialogResult 获得Show所返回的结果,代码如下:

DialogResult yesToInsert = MessageBox.Show("Seems you have already select some content in Windows Live Writer, so insert the string of selected files will overwrite your selected content." + Environment.NewLine + "Are you sure to conntinue to insert ?", "Insert Files", MessageBoxButtons.YesNo);
if (yesToInsert == DialogResult.Yes)
{
    doInsert = true;
}
else
{
    doInsert = false;
}

转载请注明:在路上 » 【已解决】C#中如何获得MessageBox的返回值

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.170 seconds, using 22.08MB memory