How do I create a message box with “Yes”, “No” choices and a DialogResult?

前端 未结 11 1805
时光取名叫无心
时光取名叫无心 2020-11-28 00:40

I want to make simple Yes/No choiced MessageBox, but I think it is nonsense to design a form for that. I thought I could use MessageBox, add buttons, etc. to accomplish this

11条回答
  •  有刺的猬
    2020-11-28 01:08

    Try this:

    if (MessageBox.Show("Are you sure", "Title_here", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
    {
        Do something here for 'Yes'...
    }
    

提交回复
热议问题