Home » c# » How to show Error & Warning Message Box in .NET/ How to Customize MessageBox

How to show Error & Warning Message Box in .NET/ How to Customize MessageBox

Posted by: admin November 29, 2017 Leave a comment

Questions:

Using C# .NET (Winforms).

I want to know how can I show the message boxes with a Ding!! sound & a red colored cross mark in it. This is what I’m talking about:

screenshot

How to do such things for my software, with custom errors and custom warnings?

MessageBox.Show("asdf");

doesn’t give me customize.

Answers:

Try this:

MessageBox.Show("Some text", "Some title", 
    MessageBoxButtons.OK, MessageBoxIcon.Error);

Questions:
Answers:

Try details: use any option..

    MessageBox.Show("your message",
    "window title", 
    MessageBoxButtons.OK, 
    MessageBoxIcon.Warning // for Warning  
    //MessageBoxIcon.Error // for Error 
    //MessageBoxIcon.Information  // for Information
    //MessageBoxIcon.Question // for Question
   );

Questions:
Answers:
MessageBox.Show(
  "your message",
  "window title", 
  MessageBoxButtons.OK, 
  MessageBoxIcon.Asterisk //For Info Asterisk
  MessageBoxIcon.Exclamation //For triangle Warning 
)

Leave a Reply

Your email address will not be published. Required fields are marked *