MessageBox Buttons?

前端 未结 6 2022
太阳男子
太阳男子 2020-12-28 14:14

How would I say if the yes button on the messagebox was pressed do this,that and the other? In C#.

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-28 14:52

    This way to check the condition while pressing 'YES' or 'NO' buttons in MessageBox window.

    DialogResult d = MessageBox.Show("Are you sure ?", "Remove Panel", MessageBoxButtons.YesNo);
                if (d == DialogResult.Yes)
                {
                    //Contents
                }
                else if (d == DialogResult.No)
                {
                    //Contents
                }
    

提交回复
热议问题