C# MessageBox dialog result

前端 未结 5 1334
心在旅途
心在旅途 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:46

    If you're using WPF and the previous answers don't help, you can retrieve the result using:

    var result = MessageBox.Show("Message", "caption", MessageBoxButton.YesNo, MessageBoxImage.Question);
    
    if (result == MessageBoxResult.Yes)
    {
        // Do something
    }
    

提交回复
热议问题