C# MessageBox dialog result

前端 未结 5 1241
心在旅途
心在旅途 2021-01-30 04:17

I want to make a MessageBox confirmation. Here is the message box:

MessageBox.Show(\"Do you want to save changes?\", \"Confirmation\", messageBoxButtons.YesNoCan         


        
5条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 04:28

    DialogResult result = MessageBox.Show("Do you want to save changes?", "Confirmation", MessageBoxButtons.YesNoCancel);
    if(result == DialogResult.Yes)
    { 
        //...
    }
    else if (result == DialogResult.No)
    { 
        //...
    }
    else
    {
        //...
    } 
    

提交回复
热议问题