I want to show YesNoCancel button in the message box, but at the same time, I wanted to disable YesNo button and enable only Cancel button.
The reason I wanted to do like this is I am doing a demo application where I want to show users that particular feature is available but at the same time I don't want to give them save access.
Following is my code, now to how to Disable YesNo button.
DialogResult result = MessageBox.Show("Save changes to " + this.Text.Substring(0, this.Text.Length - 1) + "?",
                                      "Save confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
Actually I want to show YesNo buttons but I wanted to disable click acess for it. I wanted to show users 3 buttons YES , No and Cancel but click acess should be given only to cancel button. Is that possible?
edit: Thanks all for the answers.
I have found soultion for my question
My code for custom message box, I hope this might help someone
customMsgBox.cs
enter code here { public partial class CustomMsgBox : Form
{
    static CustomMsgBox MsgBox;
    static string Button_id;
    public CustomMsgBox()
    {
        InitializeComponent();
    }
    internal static string ShowBox(string txtMessage, enumMessageIcon messageIcon)
    {
        MsgBox = new CustomMsgBox();
        MsgBox.labelCustomMsg.Text = txtMessage;
        MsgBox.addIconImage(messageIcon);
        MsgBox.ShowDialog();
        return Button_id;
    }
    /// <summary>
    /// We can use this method to add image on message box.
    /// I had taken all images in ImageList control so that
    /// I can easily add images. Image is displayed in 
    /// PictureBox control.
    /// </summary>
    /// <param name="MessageIcon">Type of image to be displayed.</param>
    private void addIconImage(enumMessageIcon MessageIcon)
    {
        switch (MessageIcon)
        {
            case enumMessageIcon.Error:
                pictureBox1.Image = imageList1.Images["Error"];  //Error is key 
                //name in imagelist control which uniquely identified images 
                //in ImageList control.
                break;
            case enumMessageIcon.Information:
                pictureBox1.Image = imageList1.Images["Information"];
                break;
            case enumMessageIcon.Question:
                pictureBox1.Image = imageList1.Images["Question"];
                break;
            case enumMessageIcon.Warning:
                pictureBox1.Image = imageList1.Images["Warning"];
                break;
        }
    }
    private void btnCancel_Click(object sender, EventArgs e)
    {
        Button_id = "Cancel";
        MsgBox.Dispose();
    }
    private void btnNo_Click(object sender, EventArgs e)
    {
        Button_id = "No";
        MsgBox.Dispose();
    }
    private void btnYes_Click(object sender, EventArgs e)
    {
        Button_id = "Yes";
        MsgBox.Dispose();
    }
}
#region constant defiend in form of enumration which is used in showMessage class.
internal enum enumMessageIcon
{
    Error,
    Warning,
    Information,
    Question,
}
internal enum enumMessageButton
{
    OK,
    YesNo,
    YesNoCancel,
    OKCancel
}
#endregion
}
main.cs
String customResult = CustomMsgBox.ShowBox("Save changes to " + this.Text.Substring(0, this.Text.Length - 1) + "?", enumMessageIcon.Question);
				
                        
The
MessageBoxButtonsEnumerations does not have such options, It contains the following membersSo the better option for you is a custom message box, for this you can try this, this or this, Or simply follow the recipe,
frmMessage) with a constructor accepts a string value that is the message that you wanted to display,Save confirmation,Usage Example:
Now you need to create an object of this message box and call them like the following: