Export (0) Print
Expand All
Expand Minimize

MessageBoxIcon Enumeration

Specifies constants defining which information to display.

[Visual Basic]
<Serializable>
Public Enum MessageBoxIcon
[C#]
[Serializable]
public enum MessageBoxIcon
[C++]
[Serializable]
__value public enum MessageBoxIcon
[JScript]
public
   Serializable
enum MessageBoxIcon

Remarks

This enumeration is used by the MessageBox class. The description of each member of this enumeration contains a typical representation of the symbol. The actual graphic displayed is a function of the operating system constants. In current implementations there are four unique symbols with multiple values assigned to them.

Members

Member name Description
Asterisk

Supported by the .NET Compact Framework.

The message box contains a symbol consisting of a lowercase letter i in a circle.
Error The message box contains a symbol consisting of white X in a circle with a red background.
Exclamation

Supported by the .NET Compact Framework.

The message box contains a symbol consisting of an exclamation point in a triangle with a yellow background.
Hand

Supported by the .NET Compact Framework.

The message box contains a symbol consisting of a white X in a circle with a red background.
Information The message box contains a symbol consisting of a lowercase letter i in a circle.
None

Supported by the .NET Compact Framework.

The message box contain no symbols.
Question

Supported by the .NET Compact Framework.

The message box contains a symbol consisting of a question mark in a circle.
Stop The message box contains a symbol consisting of white X in a circle with a red background.
Warning The message box contains a symbol consisting of an exclamation point in a triangle with a yellow background.

Example

[Visual Basic] 
Protected Sub button1_Click(sender As Object, e As System.EventArgs)
    If textBox1.Text = "" Then
        MessageBox.Show("You must enter a name.", "Name Entry Error", _
           MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    Else
        ' Code to act on the data entered would go here.
    End If
End Sub

[C#] 
protected void button1_Click(object sender, System.EventArgs e) {
   if(textBox1.Text == "") {
      MessageBox.Show("You must enter a name.", "Name Entry Error",
         MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
   }
   else {
      // Code to act on the data entered would go here.
   }
}

[C++] 
protected:
 void button1_Click(Object* /*sender*/, System::EventArgs* /*e*/) {
    if(textBox1->Text->Equals(S"")) {
       MessageBox::Show(S"You must enter a name.", S"Name Entry Error",
          MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
    }
    else {
       // Code to act on the data entered would go here.
    }
 }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Windows.Forms

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

See Also

System.Windows.Forms Namespace

Show:
© 2014 Microsoft