1

i have this code

public static bool Delete(int ID, string ProductName)
    {
        if (MessageBox.Show(productName + " will be deleted Permanently ", "Confirm Delete Option", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            {
                return false;
            }
        {
            return true;
        } 
    }

what i need to is make productName in messagebox below red in colour

if (MessageBox.Show(productName + " will be deleted Permanently "
Devraj Gadhavi
  • 3,541
  • 3
  • 38
  • 67
StackTrace
  • 9,190
  • 36
  • 114
  • 202
  • 2
    I'm afraid you will have to make your own custom message box – slawekwin Nov 08 '12 at 08:58
  • 1
    You can't do that have to make one yourself. See: http://social.msdn.microsoft.com/Forums/en/winforms/thread/7e5b9237-7502-4eba-aaed-48ebce2ce8a7 and http://stackoverflow.com/questions/2259027/bold-text-in-messagebox – Habib Nov 08 '12 at 08:59
  • 1
    @SQL.NET What has `html` got to do with the question? – Priyank Patel Nov 08 '12 at 09:04

3 Answers3

5

You have to create your own Form for this. In there you create one label and define your font. After that you can define your no and yes Button.

private void No_button_Click(object sender, EventArgs e)
{
    this.DialogResult = DialogResult.No;
    this.Close();
    this.Close();
}

The same for the yes button There are multiple other advantages by creating your own form e.g. defining position.

VMAtm
  • 27,943
  • 17
  • 79
  • 125
Daniel Abou Chleih
  • 2,440
  • 2
  • 19
  • 31
1

That can't be done with MessageBox.

You need to define your own form with the layout as you like and then show it modally.

Justin Harvey
  • 14,446
  • 2
  • 27
  • 30
0

You will need to make your own MessageBox to make this possible. It's simple as creating a form and then chaning the ForeColor with Visual Designer or with System.Drawing.Color = http://msdn.microsoft.com/en-us/library/system.drawing.color.aspx

Florian
  • 1,827
  • 4
  • 30
  • 62