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

前端 未结 11 1890
时光取名叫无心
时光取名叫无心 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:26

    @Mikael Svenson's answer is correct. I just wanted to add a small addition to it:

    The Messagebox icon can also be included has an additional property like below:

    DialogResult dialogResult = MessageBox.Show("Sure", "Please Confirm Your Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
    

提交回复
热议问题